home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / NewtonScript / Q&A NewtonScript < prev   
MacBinary  |  1994-07-12  |  126.1 KB  |  [ONLN/HLX2]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
100% file MacBinary II, inited, Thu Jul 7 14:54:23 1994, modified Tue Jul 12 09:43:50 1994, creator 'HLX2', type 'ONLN', 123175 bytes "Q&A NewtonScript" , at 0x1e1a7 5701 bytes resource default (weak)
99% file data default
100% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[ONLN]
macFileCreator[HLX2]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 10 51 26 41 20 4e 65 | 77 74 6f 6e 53 63 72 69 |..Q&A Ne|wtonScri|
|00000010| 70 74 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |pt......|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......|
|00000050| 00 00 00 00 01 e1 27 00 | 00 16 45 aa 41 ff df aa |......'.|..E.A...|
|00000060| 48 4e 96 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |HN......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ff c3 00 00 |........|........|
|00000080| 4e 45 57 54 4f 4e 53 43 | 52 49 50 54 20 50 52 4f |NEWTONSC|RIPT PRO|
|00000090| 47 52 41 4d 4d 49 4e 47 | 20 4c 41 4e 47 55 41 47 |GRAMMING| LANGUAG|
|000000a0| 45 0d a9 20 43 6f 70 79 | 72 69 67 68 74 20 31 39 |E.. Copy|right 19|
|000000b0| 39 33 2d 39 34 20 41 70 | 70 6c 65 20 43 6f 6d 70 |93-94 Ap|ple Comp|
|000000c0| 75 74 65 72 2c 20 49 6e | 63 2c 20 41 6c 6c 20 52 |uter, In|c, All R|
|000000d0| 69 67 68 74 73 20 52 65 | 73 65 72 76 65 64 0d 5f |ights Re|served._|
|000000e0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000000f0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000100| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 0d 09 0d 49 |________|____...I|
|00000110| 6e 74 72 6f 64 75 63 74 | 69 6f 6e 0d 54 68 69 73 |ntroduct|ion.This|
|00000120| 20 64 6f 63 75 6d 65 6e | 74 20 61 64 64 72 65 73 | documen|t addres|
|00000130| 73 65 73 20 4e 65 77 74 | 6f 6e 53 63 72 69 70 74 |ses Newt|onScript|
|00000140| 20 50 72 6f 67 72 61 6d | 6d 69 6e 67 20 4c 61 6e | Program|ming Lan|
|00000150| 67 75 61 67 65 20 20 69 | 73 73 75 65 73 20 74 68 |guage i|ssues th|
|00000160| 61 74 20 61 72 65 20 6e | 6f 74 20 61 76 61 69 6c |at are n|ot avail|
|00000170| 61 62 6c 65 20 69 6e 20 | 74 68 65 20 63 75 72 72 |able in |the curr|
|00000180| 65 6e 74 6c 79 20 70 72 | 69 6e 74 65 64 20 64 6f |ently pr|inted do|
|00000190| 63 75 6d 65 6e 74 61 74 | 69 6f 6e 20 2e 20 50 6c |cumentat|ion . Pl|
|000001a0| 65 61 73 65 20 6e 6f 74 | 65 20 74 68 61 74 20 74 |ease not|e that t|
|000001b0| 68 69 73 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |his info|rmation |
|000001c0| 69 73 20 73 75 62 6a 65 | 63 74 20 74 6f 20 63 68 |is subje|ct to ch|
|000001d0| 61 6e 67 65 20 61 73 20 | 74 68 65 20 4e 65 77 74 |ange as |the Newt|
|000001e0| 6f 6e 20 74 65 63 68 6e | 6f 6c 6f 67 79 20 61 6e |on techn|ology an|
|000001f0| 64 20 64 65 76 65 6c 6f | 70 6d 65 6e 74 20 65 6e |d develo|pment en|
|00000200| 76 69 72 6f 6e 6d 65 6e | 74 20 65 76 6f 6c 76 65 |vironmen|t evolve|
|00000210| 2e 0d 54 41 42 4c 45 20 | 4f 46 20 43 4f 4e 54 45 |..TABLE |OF CONTE|
|00000220| 4e 54 53 3a 0d a5 20 4e | 45 57 3a 20 4e 65 77 74 |NTS:.. N|EW: Newt|
|00000230| 6f 6e 53 63 72 69 70 74 | 20 4f 62 6a 65 63 74 20 |onScript| Object |
|00000240| 53 69 7a 65 73 20 28 36 | 2f 33 30 2f 39 34 29 0d |Sizes (6|/30/94).|
|00000250| a5 20 50 6c 61 79 20 43 | 61 74 63 68 20 2d 20 4e |. Play C|atch - N|
|00000260| 65 77 74 6f 6e 53 63 72 | 69 70 74 20 45 78 63 65 |ewtonScr|ipt Exce|
|00000270| 70 74 69 6f 6e 73 20 28 | 4f 62 73 6f 6c 65 74 65 |ptions (|Obsolete|
|00000280| 64 20 62 79 20 4e 53 20 | 47 75 69 64 65 20 31 2e |d by NS |Guide 1.|
|00000290| 30 0d 20 20 20 20 46 69 | 6e 61 6c 20 44 6f 63 75 |0. Fi|nal Docu|
|000002a0| 6d 65 6e 74 61 74 69 6f | 6e 29 0d 4e 65 77 74 6f |mentatio|n).Newto|
|000002b0| 6e 53 63 72 69 70 74 20 | 51 26 41 73 0d a5 20 47 |nScript |Q&As.. G|
|000002c0| 61 72 62 61 67 65 20 43 | 6f 6c 6c 65 63 74 69 6f |arbage C|ollectio|
|000002d0| 6e 20 28 31 30 2f 31 35 | 2f 39 33 29 20 28 6f 62 |n (10/15|/93) (ob|
|000002e0| 73 6f 6c 65 74 65 64 20 | 62 79 20 4e 53 20 47 75 |soleted |by NS Gu|
|000002f0| 69 64 65 20 31 2e 30 20 | 46 69 6e 61 6c 20 44 6f |ide 1.0 |Final Do|
|00000300| 63 75 6d 65 6e 74 61 74 | 69 6f 6e 29 0d a5 20 4f |cumentat|ion).. O|
|00000310| 72 64 65 72 20 6f 66 20 | 53 6c 6f 74 73 20 69 6e |rder of |Slots in|
|00000320| 20 46 72 61 6d 65 73 20 | 28 39 2f 31 35 2f 39 33 | Frames |(9/15/93|
|00000330| 29 20 0d a5 20 53 74 72 | 75 63 74 75 72 65 64 20 |) .. Str|uctured |
|00000340| 4c 69 74 65 72 61 6c 73 | 20 28 39 2f 31 35 2f 39 |Literals| (9/15/9|
|00000350| 33 29 20 0d a5 20 50 61 | 73 73 69 6e 67 20 41 72 |3) .. Pa|ssing Ar|
|00000360| 67 75 6d 65 6e 74 73 20 | 28 39 2f 31 35 2f 39 33 |guments |(9/15/93|
|00000370| 29 20 0d a5 20 53 6c 6f | 74 20 28 56 61 72 69 61 |) .. Slo|t (Varia|
|00000380| 62 6c 65 29 20 4c 6f 6f | 6b 75 70 20 28 39 2f 31 |ble) Loo|kup (9/1|
|00000390| 35 2f 39 33 29 20 0d a5 | 20 54 65 73 74 69 6e 67 |5/93) ..| Testing|
|000003a0| 20 74 68 65 20 45 78 69 | 73 74 65 6e 63 65 20 6f | the Exi|stence o|
|000003b0| 66 20 61 20 53 6c 6f 74 | 20 28 56 61 72 69 61 62 |f a Slot| (Variab|
|000003c0| 6c 65 29 20 28 39 2f 31 | 35 2f 39 33 29 20 28 4f |le) (9/1|5/93) (O|
|000003d0| 62 73 6f 6c 65 74 65 64 | 20 62 79 20 4e 53 20 31 |bsoleted| by NS 1|
|000003e0| 2e 30 20 46 69 6e 61 6c | 0d 20 20 20 44 6f 63 75 |.0 Final|. Docu|
|000003f0| 6d 65 6e 74 61 74 69 6f | 6e 29 0d a5 20 43 61 6c |mentatio|n).. Cal|
|00000400| 6c 69 6e 67 20 4d 65 74 | 68 6f 64 73 20 4f 75 74 |ling Met|hods Out|
|00000410| 20 4f 66 20 53 6c 6f 74 | 20 43 6f 6e 74 65 78 74 | Of Slot| Context|
|00000420| 20 28 39 2f 31 35 2f 39 | 33 29 20 28 4f 62 73 6f | (9/15/9|3) (Obso|
|00000430| 6c 65 74 65 64 20 62 79 | 20 4e 53 20 47 75 69 64 |leted by| NS Guid|
|00000440| 65 20 31 2e 30 20 46 69 | 6e 61 6c 20 0d 20 20 20 |e 1.0 Fi|nal . |
|00000450| 44 6f 63 75 6d 65 6e 74 | 61 74 69 6f 6e 29 0d a5 |Document|ation)..|
|00000460| 20 49 6e 68 65 72 69 74 | 65 64 20 28 31 30 2f 31 | Inherit|ed (10/1|
|00000470| 33 2f 39 33 29 20 28 4f | 62 73 6f 6c 65 74 65 64 |3/93) (O|bsoleted|
|00000480| 20 62 79 20 4e 53 20 47 | 75 69 64 65 20 31 2e 30 | by NS G|uide 1.0|
|00000490| 20 46 69 6e 61 6c 20 44 | 6f 63 75 6d 65 6e 74 61 | Final D|ocumenta|
|000004a0| 74 69 6f 6e 29 0d a5 20 | 44 65 65 70 6c 79 20 28 |tion).. |Deeply (|
|000004b0| 66 6f 72 65 61 63 68 20 | 64 65 65 70 6c 79 20 69 |foreach |deeply i|
|000004c0| 6e 2e 2e 2e 29 20 28 31 | 30 2f 31 33 2f 39 33 29 |n...) (1|0/13/93)|
|000004d0| 28 4f 62 73 6f 6c 65 74 | 65 64 20 62 79 20 4e 53 |(Obsolet|ed by NS|
|000004e0| 20 47 75 69 64 65 20 31 | 2e 30 20 46 69 6e 61 6c | Guide 1|.0 Final|
|000004f0| 20 0d 20 20 20 44 6f 63 | 75 6d 65 6e 74 61 74 69 | . Doc|umentati|
|00000500| 6f 6e 29 0d a5 20 43 6f | 6d 70 69 6c 65 20 46 75 |on).. Co|mpile Fu|
|00000510| 6e 63 74 69 6f 6e 20 28 | 31 30 2f 39 2f 39 33 29 |nction (|10/9/93)|
|00000520| 20 28 4f 62 73 6f 6c 65 | 74 65 64 20 62 79 20 4e | (Obsole|ted by N|
|00000530| 53 20 47 75 69 64 65 20 | 31 2e 30 20 46 69 6e 61 |S Guide |1.0 Fina|
|00000540| 6c 20 44 6f 63 75 6d 65 | 6e 74 61 74 69 6f 6e 29 |l Docume|ntation)|
|00000550| 0d a5 20 46 75 6e 63 74 | 69 6f 6e 20 44 65 66 69 |.. Funct|ion Defi|
|00000560| 6e 69 74 69 6f 6e 73 20 | 28 31 30 2f 39 2f 39 33 |nitions |(10/9/93|
|00000570| 29 0d a5 20 43 6c 6f 73 | 75 72 65 73 20 61 6e 64 |).. Clos|ures and|
|00000580| 20 50 65 72 66 6f 72 6d | 20 28 31 30 2f 39 2f 39 | Perform| (10/9/9|
|00000590| 33 29 20 28 4f 62 73 6f | 6c 65 74 65 64 20 62 79 |3) (Obso|leted by|
|000005a0| 20 4e 53 20 47 75 69 64 | 65 20 31 2e 30 20 46 69 | NS Guid|e 1.0 Fi|
|000005b0| 6e 61 6c 20 44 6f 63 75 | 6d 65 6e 74 61 74 69 6f |nal Docu|mentatio|
|000005c0| 6e 29 0d a5 20 53 79 6d | 62 6f 6c 20 48 61 63 6b |n).. Sym|bol Hack|
|000005d0| 69 6e 67 20 28 31 31 2f | 31 31 2f 39 33 29 20 28 |ing (11/|11/93) (|
|000005e0| 4f 62 73 6f 6c 65 74 65 | 64 20 62 79 20 4e 53 20 |Obsolete|d by NS |
|000005f0| 47 75 69 64 65 20 31 2e | 30 20 46 69 6e 61 6c 20 |Guide 1.|0 Final |
|00000600| 44 6f 63 75 6d 65 6e 74 | 61 74 69 6f 6e 29 0d a5 |Document|ation)..|
|00000610| 20 4c 69 74 65 72 61 6c | 73 20 61 6e 64 20 52 75 | Literal|s and Ru|
|00000620| 6e 74 69 6d 65 20 28 31 | 31 2f 31 31 2f 39 33 29 |ntime (1|1/11/93)|
|00000630| 0d a5 20 4d 69 73 73 69 | 6e 67 20 53 65 6d 69 43 |.. Missi|ng SemiC|
|00000640| 6f 6c 6f 6e 73 20 63 61 | 75 73 65 20 57 65 69 72 |olons ca|use Weir|
|00000650| 64 20 45 72 72 6f 72 73 | 20 28 31 32 2f 31 31 2f |d Errors| (12/11/|
|00000660| 39 33 29 20 28 4f 62 73 | 6f 6c 65 74 65 64 20 62 |93) (Obs|oleted b|
|00000670| 79 20 4e 53 20 47 75 69 | 64 65 20 31 2e 30 20 0d |y NS Gui|de 1.0 .|
|00000680| 20 20 20 46 69 6e 61 6c | 20 44 6f 63 75 6d 65 6e | Final| Documen|
|00000690| 74 61 74 69 6f 6e 29 0d | a5 20 43 6c 61 73 73 69 |tation).|. Classi|
|000006a0| 63 61 6c 20 4f 4f 50 20 | 70 72 6f 67 72 61 6d 6d |cal OOP |programm|
|000006b0| 69 6e 67 20 61 6c 61 20 | 4e 65 77 74 6f 6e 53 63 |ing ala |NewtonSc|
|000006c0| 72 69 70 74 20 28 31 32 | 2f 31 37 2f 39 33 29 20 |ript (12|/17/93) |
|000006d0| 28 4f 62 73 6f 6c 65 74 | 65 64 20 62 79 20 4e 53 |(Obsolet|ed by NS|
|000006e0| 20 47 75 69 64 65 20 31 | 2e 30 20 0d 20 20 20 46 | Guide 1|.0 . F|
|000006f0| 69 6e 61 6c 20 44 6f 63 | 75 6d 65 6e 74 61 74 69 |inal Doc|umentati|
|00000700| 6f 6e 29 0d a5 20 4f 6e | 6c 79 20 37 2d 42 69 74 |on).. On|ly 7-Bit|
|00000710| 20 41 53 43 49 49 20 49 | 6e 20 4e 65 77 74 6f 6e | ASCII I|n Newton|
|00000720| 53 63 72 69 70 74 20 53 | 79 6d 62 6f 6c 73 20 28 |Script S|ymbols (|
|00000730| 31 2f 32 36 2f 39 34 29 | 20 28 4f 62 73 6f 6c 65 |1/26/94)| (Obsole|
|00000740| 74 65 64 20 62 79 20 4e | 53 20 47 75 69 64 65 20 |ted by N|S Guide |
|00000750| 31 2e 30 20 0d 20 20 20 | 46 69 6e 61 6c 20 44 6f |1.0 . |Final Do|
|00000760| 63 75 6d 65 6e 74 61 74 | 69 6f 6e 29 0d a5 20 4e |cumentat|ion).. N|
|00000770| 65 73 74 65 64 20 49 46 | 20 53 74 61 74 65 6d 65 |ested IF| Stateme|
|00000780| 6e 74 73 2c 20 43 6f 6e | 73 74 61 6e 74 20 43 6f |nts, Con|stant Co|
|00000790| 6e 64 69 74 69 6f 6e 20 | 50 72 6f 62 6c 65 6d 73 |ndition |Problems|
|000007a0| 20 28 36 2f 39 2f 39 34 | 29 0d a5 20 4e 45 57 3a | (6/9/94|).. NEW:|
|000007b0| 20 48 6f 77 20 74 6f 20 | 41 76 6f 69 64 20 5f 70 | How to |Avoid _p|
|000007c0| 61 72 65 6e 74 20 50 72 | 6f 62 6c 65 6d 73 20 28 |arent Pr|oblems (|
|000007d0| 36 2f 32 38 2f 39 34 29 | 0d 5f 5f 5f 5f 5f 5f 5f |6/28/94)|._______|
|000007e0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000007f0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000800| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000810| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000820| 5f 5f 5f 5f 5f 5f 09 0d | 4e 45 57 3a 20 4e 65 77 |______..|NEW: New|
|00000830| 74 6f 6e 53 63 72 69 70 | 74 20 4f 62 6a 65 63 74 |tonScrip|t Object|
|00000840| 20 53 69 7a 65 73 20 28 | 36 2f 33 30 2f 39 34 29 | Sizes (|6/30/94)|
|00000850| 0d 47 65 6e 65 72 69 63 | 0d 54 68 65 20 4e 65 77 |.Generic|.The New|
|00000860| 74 6f 6e 73 63 72 69 70 | 74 20 4f 62 6a 65 63 74 |tonscrip|t Object|
|00000870| 73 20 61 72 65 20 74 68 | 65 20 6f 62 6a 65 63 74 |s are th|e object|
|00000880| 73 20 74 68 61 74 20 65 | 69 74 68 65 72 20 72 65 |s that e|ither re|
|00000890| 73 69 64 65 20 69 6e 20 | 74 68 65 20 72 65 61 64 |side in |the read|
|000008a0| 2d 77 72 69 74 65 20 6d | 65 6d 6f 72 79 2c 20 20 |-write m|emory, |
|000008b0| 70 73 65 75 64 6f 2d 52 | 4f 4d 20 6d 65 6d 6f 72 |pseudo-R|OM memor|
|000008c0| 79 20 6f 72 20 69 6e 73 | 69 64 65 20 74 68 65 20 |y or ins|ide the |
|000008d0| 70 61 63 6b 61 67 65 20 | 6f 72 20 52 4f 4d 2e 20 |package |or ROM. |
|000008e0| 54 68 65 73 65 20 6f 62 | 6a 65 63 74 73 20 61 72 |These ob|jects ar|
|000008f0| 65 20 61 6c 69 67 6e 65 | 64 20 74 6f 20 38 2d 62 |e aligne|d to 8-b|
|00000900| 79 74 65 20 62 6f 75 6e | 64 61 72 69 65 73 2e 20 |yte boun|daries. |
|00000910| 54 68 69 73 20 61 6c 69 | 67 6e 6d 65 6e 74 20 63 |This ali|gnment c|
|00000920| 61 75 73 65 73 20 61 20 | 76 65 72 79 20 73 6d 61 |auses a |very sma|
|00000930| 6c 6c 20 61 6d 6f 75 6e | 74 20 6f 66 20 66 72 61 |ll amoun|t of fra|
|00000940| 67 6d 65 6e 74 61 74 69 | 6f 6e 20 28 75 73 75 61 |gmentati|on (usua|
|00000950| 6c 6c 79 20 75 6e 64 65 | 72 20 32 25 29 20 73 6f |lly unde|r 2%) so|
|00000960| 20 74 68 69 73 20 69 73 | 73 75 65 20 63 6f 75 6c | this is|sue coul|
|00000970| 64 20 62 65 20 69 67 6e | 6f 72 65 64 2e 20 0d 49 |d be ign|ored. .I|
|00000980| 6d 6d 65 64 69 61 74 65 | 73 0d 54 68 65 20 4e 65 |mmediate|s.The Ne|
|00000990| 77 74 6f 6e 20 4f 62 6a | 65 63 74 20 53 79 73 74 |wton Obj|ect Syst|
|000009a0| 65 6d 20 68 61 73 20 66 | 6f 75 72 20 62 75 69 6c |em has f|our buil|
|000009b0| 74 2d 69 6e 20 70 72 69 | 6d 69 74 69 76 65 20 63 |t-in pri|mitive c|
|000009c0| 6c 61 73 73 65 73 20 74 | 68 61 74 20 64 65 73 63 |lasses t|hat desc|
|000009d0| 72 69 62 65 20 61 6e 20 | 6f 62 6a 65 63 74 27 73 |ribe an |object's|
|000009e0| 20 62 61 73 69 63 20 74 | 79 70 65 3a 20 49 6d 6d | basic t|ype: Imm|
|000009f0| 65 64 69 61 74 65 73 2c | 20 62 69 6e 61 72 69 65 |ediates,| binarie|
|00000a00| 73 2c 20 61 72 72 61 79 | 73 20 61 6e 64 20 66 72 |s, array|s and fr|
|00000a10| 61 6d 65 73 2e 20 49 6e | 20 74 68 65 20 63 61 73 |ames. In| the cas|
|00000a20| 65 20 6f 66 20 61 6e 20 | 49 6d 6d 65 64 69 61 74 |e of an |Immediat|
|00000a30| 65 73 20 28 69 6e 74 65 | 67 65 72 73 2c 20 63 68 |es (inte|gers, ch|
|00000a40| 61 72 61 63 74 65 72 2c | 20 62 6f 6f 6c 65 61 6e |aracter,| boolean|
|00000a50| 20 61 6e 64 20 73 6f 20 | 6f 6e 29 20 20 77 65 20 | and so |on) we |
|00000a60| 61 72 65 20 64 65 61 6c | 69 6e 67 20 77 69 74 68 |are deal|ing with|
|00000a70| 20 61 20 33 30 2b 32 20 | 62 69 74 20 6f 62 6a 65 | a 30+2 |bit obje|
|00000a80| 63 74 2e 20 20 0d 49 6e | 20 74 68 65 20 63 61 73 |ct. .In| the cas|
|00000a90| 65 20 6f 66 20 62 69 6e | 61 72 69 65 73 2c 20 61 |e of bin|aries, a|
|00000aa0| 72 72 61 79 73 20 61 6e | 64 20 66 72 61 6d 65 73 |rrays an|d frames|
|00000ab0| 20 77 65 20 61 72 65 20 | 61 6c 73 6f 20 64 65 61 | we are |also dea|
|00000ac0| 6c 69 6e 67 20 77 69 74 | 68 20 6f 62 6a 65 63 74 |ling wit|h object|
|00000ad0| 73 20 63 6f 6e 74 61 69 | 6e 69 6e 67 20 61 20 73 |s contai|ning a s|
|00000ae0| 6f 20 63 61 6c 6c 65 64 | 20 4f 62 6a 65 63 74 20 |o called| Object |
|00000af0| 48 65 61 64 65 72 2e 0d | 4f 62 6a 65 63 74 20 48 |Header..|Object H|
|00000b00| 65 61 64 65 72 0d 45 76 | 65 72 79 20 6f 62 6a 65 |eader.Ev|ery obje|
|00000b10| 63 74 20 68 61 73 20 61 | 20 31 32 2d 62 79 74 65 |ct has a| 12-byte|
|00000b20| 20 68 65 61 64 65 72 20 | 74 68 61 74 20 63 6f 6e | header |that con|
|00000b30| 74 61 69 6e 73 20 69 6e | 66 6f 72 6d 61 74 69 6f |tains in|formatio|
|00000b40| 6e 20 63 6f 6e 63 65 72 | 6e 69 6e 67 20 73 69 7a |n concer|ning siz|
|00000b50| 65 2c 20 66 6c 61 67 73 | 2c 20 63 6c 61 73 73 2c |e, flags|, class,|
|00000b60| 20 6c 6f 63 6b 20 63 6f | 75 6e 74 20 61 6e 64 20 | lock co|unt and |
|00000b70| 73 6f 20 6f 6e 2e 20 54 | 68 69 73 20 69 6e 66 6f |so on. T|his info|
|00000b80| 72 6d 61 74 69 6f 6e 20 | 69 73 20 69 6d 70 6c 65 |rmation |is imple|
|00000b90| 6d 65 6e 74 61 74 69 6f | 6e 20 73 70 65 63 69 66 |mentatio|n specif|
|00000ba0| 69 63 2e 0d 53 74 72 69 | 6e 67 73 0d 41 20 73 74 |ic..Stri|ngs.A st|
|00000bb0| 72 69 6e 67 20 6f 62 6a | 65 63 74 20 63 6f 6e 74 |ring obj|ect cont|
|00000bc0| 61 69 6e 73 20 61 20 31 | 32 20 62 79 74 65 20 68 |ains a 1|2 byte h|
|00000bd0| 65 61 64 65 72 20 70 6c | 75 73 20 74 68 65 20 55 |eader pl|us the U|
|00000be0| 6e 69 63 6f 64 65 20 73 | 74 72 69 6e 67 73 20 70 |nicode s|trings p|
|00000bf0| 6c 75 73 20 61 20 6e 75 | 6c 6c 20 74 65 72 6d 69 |lus a nu|ll termi|
|00000c00| 6e 61 74 69 6f 6e 20 63 | 68 61 72 61 63 74 65 72 |nation c|haracter|
|00000c10| 2e 20 4e 6f 74 65 20 74 | 68 61 74 20 55 6e 69 63 |. Note t|hat Unic|
|00000c20| 6f 64 65 20 63 68 61 72 | 61 63 74 65 72 73 20 61 |ode char|acters a|
|00000c30| 72 65 20 74 77 6f 2d 62 | 79 74 65 20 76 61 6c 75 |re two-b|yte valu|
|00000c40| 65 73 2e 20 48 65 72 65 | 27 73 20 61 6e 20 65 78 |es. Here|'s an ex|
|00000c50| 61 6d 70 6c 65 3a 0d 22 | 48 65 6c 6c 6f 20 57 6f |ample:."|Hello Wo|
|00000c60| 72 6c 64 21 22 0d 54 68 | 69 73 20 73 74 72 69 6e |rld!".Th|is strin|
|00000c70| 67 20 63 6f 6e 74 61 69 | 6e 73 20 31 32 20 63 68 |g contai|ns 12 ch|
|00000c80| 61 72 61 63 74 65 72 73 | 2c 20 69 6e 20 6f 74 68 |aracters|, in oth|
|00000c90| 65 72 20 77 6f 72 64 73 | 20 69 74 20 68 61 73 20 |er words| it has |
|00000ca0| 32 34 20 20 62 79 74 65 | 73 2e 20 49 6e 20 61 64 |24 byte|s. In ad|
|00000cb0| 64 69 74 69 6f 6e 20 77 | 65 20 68 61 76 65 20 61 |dition w|e have a|
|00000cc0| 20 6e 75 6c 6c 20 74 65 | 72 6d 69 6e 61 74 69 6f | null te|rminatio|
|00000cd0| 6e 20 63 68 61 72 61 63 | 74 65 72 20 28 32 34 20 |n charac|ter (24 |
|00000ce0| 20 2b 20 32 20 62 79 74 | 65 73 29 20 61 6e 64 20 | + 2 byt|es) and |
|00000cf0| 61 6e 20 6f 62 6a 65 63 | 74 20 68 65 61 64 65 72 |an objec|t header|
|00000d00| 20 20 28 32 34 20 2b 20 | 32 20 2b 20 31 32 20 62 | (24 + |2 + 12 b|
|00000d10| 79 74 65 73 29 2c 20 61 | 6c 6c 20 69 6e 20 61 6c |ytes), a|ll in al|
|00000d20| 6c 20 74 68 65 20 6f 62 | 6a 65 63 74 20 69 73 20 |l the ob|ject is |
|00000d30| 33 38 20 62 79 74 65 73 | 20 62 69 67 2e 20 4e 6f |38 bytes| big. No|
|00000d40| 74 65 20 74 68 61 74 20 | 77 65 20 68 61 76 65 20 |te that |we have |
|00000d50| 6e 6f 74 20 74 61 6b 65 | 6e 20 69 6e 74 6f 20 61 |not take|n into a|
|00000d60| 63 63 6f 75 6e 74 20 61 | 6e 79 20 70 6f 73 73 69 |ccount a|ny possi|
|00000d70| 62 6c 65 20 73 61 76 69 | 6e 67 73 20 69 66 20 74 |ble savi|ngs if t|
|00000d80| 68 65 20 73 74 72 69 6e | 67 20 77 61 73 20 63 6f |he strin|g was co|
|00000d90| 6d 70 72 65 73 73 65 64 | 20 28 75 73 69 6e 67 20 |mpressed| (using |
|00000da0| 74 68 65 20 4e 54 4b 20 | 63 6f 6d 70 72 65 73 73 |the NTK |compress|
|00000db0| 69 6f 6e 20 66 6c 61 67 | 73 29 2e 0d 42 69 6e 61 |ion flag|s)..Bina|
|00000dc0| 72 79 20 4f 62 6a 65 63 | 74 73 0d 41 20 62 69 6e |ry Objec|ts.A bin|
|00000dd0| 61 72 79 20 6f 62 6a 65 | 63 74 20 63 6f 6e 74 61 |ary obje|ct conta|
|00000de0| 69 6e 73 20 20 61 20 31 | 32 20 62 79 74 65 20 68 |ins a 1|2 byte h|
|00000df0| 65 61 64 65 72 20 70 6c | 75 73 20 74 68 65 20 73 |eader pl|us the s|
|00000e00| 69 7a 65 20 6f 66 20 74 | 68 65 20 61 63 74 75 61 |ize of t|he actua|
|00000e10| 6c 20 64 61 74 61 2e 0d | 41 72 72 61 79 20 4f 62 |l data..|Array Ob|
|00000e20| 6a 65 63 74 73 0d 41 72 | 72 61 79 20 6f 62 6a 65 |jects.Ar|ray obje|
|00000e30| 63 74 73 20 68 61 76 65 | 20 61 6e 20 6f 62 6a 65 |cts have| an obje|
|00000e40| 63 74 20 68 65 61 64 65 | 72 20 28 31 32 20 62 79 |ct heade|r (12 by|
|00000e50| 74 65 73 29 20 61 6e 64 | 20 61 64 64 69 74 69 6f |tes) and| additio|
|00000e60| 6e 61 6c 20 66 6f 75 72 | 20 62 79 74 65 73 20 70 |nal four| bytes p|
|00000e70| 65 72 20 65 6c 65 6d 65 | 6e 74 2e 20 49 6e 20 61 |er eleme|nt. In a|
|00000e80| 64 64 69 74 69 6f 6e 20 | 79 6f 75 20 6e 65 65 64 |ddition |you need|
|00000e90| 20 74 6f 20 63 61 6c 63 | 75 6c 61 74 65 20 74 68 | to calc|ulate th|
|00000ea0| 65 20 61 6d 6f 75 6e 74 | 20 6f 66 20 64 61 74 61 |e amount| of data|
|00000eb0| 20 73 74 6f 72 65 64 20 | 69 6e 20 74 68 65 20 61 | stored |in the a|
|00000ec0| 72 72 61 79 73 20 61 73 | 20 77 65 6c 6c 20 28 72 |rrays as| well (r|
|00000ed0| 65 66 65 72 65 6e 63 65 | 73 29 20 69 66 20 79 6f |eference|s) if yo|
|00000ee0| 75 20 77 61 6e 74 20 74 | 6f 20 63 61 6c 63 75 6c |u want t|o calcul|
|00000ef0| 61 74 65 20 74 68 65 20 | 74 6f 74 61 6c 20 61 6d |ate the |total am|
|00000f00| 6f 75 6e 74 2e 0d 48 65 | 72 65 27 73 20 61 6e 20 |ount..He|re's an |
|00000f10| 65 78 61 6d 70 6c 65 3a | 0d 5b 22 48 65 6c 6c 6f |example:|.["Hello|
|00000f20| 20 57 6f 72 6c 64 21 22 | 2c 20 22 66 6f 6f 22 5d | World!"|, "foo"]|
|00000f30| 0d 57 65 20 68 61 76 65 | 20 61 20 68 65 61 64 65 |.We have| a heade|
|00000f40| 72 20 28 31 32 20 62 79 | 74 65 73 29 20 70 6c 75 |r (12 by|tes) plu|
|00000f50| 73 20 66 6f 75 72 20 62 | 79 74 65 73 20 70 65 72 |s four b|ytes per|
|00000f60| 20 65 6c 65 6d 65 6e 74 | 20 28 31 32 20 20 2b 20 | element| (12 + |
|00000f70| 28 32 20 2a 20 34 29 20 | 20 62 79 74 65 73 29 2e |(2 * 4) | bytes).|
|00000f80| 20 49 6e 20 61 64 64 69 | 74 69 6f 6e 20 77 65 20 | In addi|tion we |
|00000f90| 68 61 76 65 20 73 74 72 | 69 6e 67 20 6f 62 6a 65 |have str|ing obje|
|00000fa0| 63 74 73 20 74 68 61 74 | 20 77 65 20 72 65 66 65 |cts that| we refe|
|00000fb0| 72 20 74 6f 20 20 28 31 | 32 20 2b 20 28 32 2a 34 |r to (1|2 + (2*4|
|00000fc0| 29 20 2b 20 33 38 20 2b | 20 32 30 20 62 79 74 65 |) + 38 +| 20 byte|
|00000fd0| 73 29 2c 20 61 6c 6c 20 | 69 6e 20 61 6c 6c 20 37 |s), all |in all 7|
|00000fe0| 38 20 62 79 74 65 73 2e | 20 41 67 61 69 6e 20 77 |8 bytes.| Again w|
|00000ff0| 65 20 68 61 76 65 20 6e | 6f 74 20 74 61 6b 65 6e |e have n|ot taken|
|00001000| 20 69 6e 74 6f 20 61 63 | 63 6f 75 6e 74 20 73 61 | into ac|count sa|
|00001010| 76 69 6e 67 73 20 63 6f | 6e 63 65 72 6e 69 6e 67 |vings co|ncerning|
|00001020| 20 63 6f 6d 70 72 65 73 | 73 69 6f 6e 2e 20 4e 6f | compres|sion. No|
|00001030| 74 65 20 74 68 61 74 20 | 74 68 65 20 73 74 72 69 |te that |the stri|
|00001040| 6e 67 20 6f 62 6a 65 63 | 74 73 20 63 6f 75 6c 64 |ng objec|ts could|
|00001050| 20 62 65 20 72 65 66 65 | 72 72 65 64 20 62 79 20 | be refe|rred by |
|00001060| 6f 74 68 65 72 20 61 72 | 72 61 79 73 20 61 6e 64 |other ar|rays and|
|00001070| 20 66 72 61 6d 65 73 20 | 61 73 20 77 65 6c 6c 2c | frames |as well,|
|00001080| 20 73 6f 20 69 66 20 77 | 65 20 77 61 6e 74 20 74 | so if w|e want t|
|00001090| 6f 20 74 61 6b 65 20 74 | 68 69 73 20 69 6e 74 6f |o take t|his into|
|000010a0| 20 61 63 63 6f 75 6e 74 | 20 77 65 20 73 68 6f 75 | account| we shou|
|000010b0| 6c 64 20 6d 61 6b 65 20 | 73 75 72 65 20 74 68 65 |ld make |sure the|
|000010c0| 20 73 74 72 69 6e 67 20 | 69 73 20 63 6f 75 6e 74 | string |is count|
|000010d0| 65 64 20 6f 6e 6c 79 20 | 6f 6e 63 65 20 70 65 72 |ed only |once per|
|000010e0| 20 70 61 63 6b 61 67 65 | 2e 0d 46 72 61 6d 65 20 | package|..Frame |
|000010f0| 4f 62 6a 65 63 74 73 0d | 57 65 20 68 61 76 65 20 |Objects.|We have |
|00001100| 74 77 6f 20 6b 69 6e 64 | 73 20 6f 66 20 66 72 61 |two kind|s of fra|
|00001110| 6d 65 73 2c 20 66 72 61 | 6d 65 73 20 74 68 61 74 |mes, fra|mes that|
|00001120| 20 64 6f 6e 27 74 20 68 | 61 76 65 20 61 20 73 68 | don't h|ave a sh|
|00001130| 61 72 65 64 20 6d 61 70 | 20 6f 62 6a 65 63 74 2c |ared map| object,|
|00001140| 20 61 6e 64 20 66 72 61 | 6d 65 73 20 77 68 6f 20 | and fra|mes who |
|00001150| 64 6f 20 68 61 76 65 20 | 61 20 73 68 61 72 65 64 |do have |a shared|
|00001160| 20 6d 61 70 20 6f 62 6a | 65 63 74 2e 20 57 65 20 | map obj|ect. We |
|00001170| 74 61 6b 65 20 74 68 65 | 20 73 69 6d 70 6c 65 20 |take the| simple |
|00001180| 63 61 73 65 20 66 69 72 | 73 74 20 28 6e 6f 20 73 |case fir|st (no s|
|00001190| 68 61 72 65 64 20 6d 61 | 70 20 6f 62 6a 65 63 74 |hared ma|p object|
|000011a0| 29 2e 0d 41 6e 20 61 72 | 72 61 79 20 6f 62 6a 65 |)..An ar|ray obje|
|000011b0| 63 74 20 6d 61 70 20 69 | 73 20 61 6e 20 61 72 72 |ct map i|s an arr|
|000011c0| 61 79 20 6f 66 20 73 79 | 6d 62 6f 6c 20 70 6f 69 |ay of sy|mbol poi|
|000011d0| 6e 74 65 72 73 20 61 6e | 64 20 6f 6e 65 20 61 64 |nters an|d one ad|
|000011e0| 64 69 74 69 6f 6e 61 6c | 20 73 6c 6f 74 2e 20 54 |ditional| slot. T|
|000011f0| 68 65 20 61 63 74 75 61 | 6c 20 66 72 61 6d 65 20 |he actua|l frame |
|00001200| 69 73 20 74 77 6f 20 61 | 72 72 61 79 73 2c 20 6f |is two a|rrays, o|
|00001210| 6e 65 20 63 6f 6e 74 61 | 69 6e 73 20 74 68 65 20 |ne conta|ins the |
|00001220| 73 6c 6f 74 20 6e 61 6d | 65 73 2c 20 61 6e 64 20 |slot nam|es, and |
|00001230| 74 68 65 20 6f 74 68 65 | 72 20 63 6f 6e 74 61 69 |the othe|r contai|
|00001240| 6e 73 20 74 68 65 20 61 | 63 74 75 61 6c 20 73 6c |ns the a|ctual sl|
|00001250| 6f 74 20 65 6e 74 72 79 | 2e 0d 54 68 65 20 6d 61 |ot entry|..The ma|
|00001260| 70 20 69 73 20 31 36 20 | 62 79 74 65 73 2c 20 69 |p is 16 |bytes, i|
|00001270| 66 20 77 65 20 61 64 64 | 20 74 68 65 20 6f 62 6a |f we add| the obj|
|00001280| 65 63 74 20 68 65 61 64 | 65 72 20 74 6f 20 74 68 |ect head|er to th|
|00001290| 69 73 20 74 68 65 20 62 | 61 73 69 63 20 68 65 61 |is the b|asic hea|
|000012a0| 64 65 72 20 73 69 7a 65 | 20 6f 66 20 61 20 66 72 |der size| of a fr|
|000012b0| 61 6d 65 20 69 73 20 32 | 38 20 62 79 74 65 73 2e |ame is 2|8 bytes.|
|000012c0| 20 20 49 66 20 77 65 20 | 77 61 6e 74 20 74 6f 20 | If we |want to |
|000012d0| 61 64 64 20 74 68 65 20 | 73 69 7a 65 20 74 61 6b |add the |size tak|
|000012e0| 65 6e 20 62 79 20 73 6c | 6f 74 20 65 6e 74 72 69 |en by sl|ot entri|
|000012f0| 65 73 20 77 65 20 6d 75 | 6c 74 69 70 6c 79 20 4e |es we mu|ltiply N|
|00001300| 20 73 6c 6f 74 73 20 77 | 69 74 68 20 38 20 28 74 | slots w|ith 8 (t|
|00001310| 77 6f 20 61 72 72 61 79 | 20 65 6e 74 72 69 65 73 |wo array| entries|
|00001320| 29 2e 20 48 65 72 65 27 | 73 20 61 6e 20 65 78 61 |). Here'|s an exa|
|00001330| 6d 70 6c 65 3a 0d 7b 53 | 6c 6f 74 31 3a 20 34 32 |mple:.{S|lot1: 42|
|00001340| 2c 20 53 6c 6f 74 32 3a | 20 22 68 65 6c 6c 6f 22 |, Slot2:| "hello"|
|00001350| 7d 0d 57 65 20 68 61 76 | 65 20 61 20 68 65 61 64 |}.We hav|e a head|
|00001360| 65 72 20 6f 66 20 32 38 | 20 62 79 74 65 73 2c 20 |er of 28| bytes, |
|00001370| 69 6e 20 61 64 64 69 74 | 69 6f 6e 20 77 65 20 68 |in addit|ion we h|
|00001380| 61 76 65 20 74 77 6f 20 | 73 6c 6f 74 73 20 28 32 |ave two |slots (2|
|00001390| 38 20 2b 20 28 32 20 2a | 20 38 29 29 2c 20 61 6c |8 + (2 *| 8)), al|
|000013a0| 6c 20 69 6e 20 61 6c 6c | 20 20 34 38 20 62 79 74 |l in all| 48 byt|
|000013b0| 65 73 2e 20 4f 6e 63 65 | 20 61 67 61 69 6e 20 77 |es. Once| again w|
|000013c0| 65 20 64 69 64 6e 27 74 | 20 63 61 6c 63 75 6c 61 |e didn't| calcula|
|000013d0| 74 65 20 74 68 65 20 61 | 63 74 75 61 6c 20 73 6c |te the a|ctual sl|
|000013e0| 6f 74 20 65 6e 74 72 79 | 20 6f 62 6a 65 63 74 73 |ot entry| objects|
|000013f0| 2e 0d 49 6e 20 74 68 65 | 20 63 61 73 65 20 6f 66 |..In the| case of|
|00001400| 20 61 20 66 72 61 6d 65 | 20 77 69 74 68 20 61 20 | a frame| with a |
|00001410| 73 68 61 72 65 64 20 6d | 61 70 20 6d 75 6c 74 69 |shared m|ap multi|
|00001420| 70 6c 65 20 73 69 6d 69 | 6c 61 72 20 66 72 61 6d |ple simi|lar fram|
|00001430| 65 73 20 28 6c 6f 6f 6b | 20 74 68 65 20 73 61 6d |es (look| the sam|
|00001440| 65 29 20 63 6f 75 6c 64 | 20 73 68 61 72 65 20 74 |e) could| share t|
|00001450| 68 65 20 6f 6e 65 20 61 | 6e 64 20 6f 6e 6c 79 20 |he one a|nd only |
|00001460| 6d 61 70 2e 20 54 68 69 | 73 20 77 69 6c 6c 20 73 |map. Thi|s will s|
|00001470| 61 76 65 20 73 70 61 63 | 65 2c 20 72 65 64 75 63 |ave spac|e, reduc|
|00001480| 69 6e 67 20 74 68 65 20 | 6d 61 72 67 69 6e 61 6c |ing the |marginal|
|00001490| 20 6f 76 65 72 68 65 61 | 64 20 70 65 72 20 66 72 | overhea|d per fr|
|000014a0| 61 6d 65 20 74 6f 20 74 | 68 65 20 73 61 6d 65 20 |ame to t|he same |
|000014b0| 61 73 20 61 6e 20 61 72 | 72 61 79 20 77 69 74 68 |as an ar|ray with|
|000014c0| 20 74 68 65 20 73 61 6d | 65 20 61 6d 6f 75 6e 74 | the sam|e amount|
|000014d0| 20 6f 66 20 73 6c 6f 74 | 73 2e 20 49 6e 20 61 64 | of slot|s. In ad|
|000014e0| 64 69 74 69 6f 6e 20 77 | 65 20 6e 65 65 64 20 74 |dition w|e need t|
|000014f0| 6f 20 74 61 6b 65 20 69 | 6e 74 6f 20 61 63 63 6f |o take i|nto acco|
|00001500| 75 6e 74 20 74 68 65 20 | 61 6d 6f 72 74 69 7a 65 |unt the |amortize|
|00001510| 64 20 6d 61 70 20 73 69 | 7a 65 20 74 68 61 74 20 |d map si|ze that |
|00001520| 6d 75 6c 74 69 70 6c 65 | 20 66 72 61 6d 65 73 20 |multiple| frames |
|00001530| 73 68 61 72 65 2e 20 49 | 6e 20 6f 74 68 65 72 20 |share. I|n other |
|00001540| 77 6f 72 64 73 20 74 68 | 65 20 6d 61 67 69 63 20 |words th|e magic |
|00001550| 66 6f 72 6d 75 6c 61 20 | 74 68 69 73 20 74 69 6d |formula |this tim|
|00001560| 65 20 69 73 20 31 32 20 | 62 79 74 65 73 20 66 6f |e is 12 |bytes fo|
|00001570| 72 20 74 68 65 20 68 65 | 61 64 65 72 20 70 6c 75 |r the he|ader plu|
|00001580| 73 20 20 34 20 74 69 6d | 65 73 20 74 68 65 20 61 |s 4 tim|es the a|
|00001590| 6d 6f 75 6e 74 20 6f 66 | 20 73 6c 6f 74 73 20 70 |mount of| slots p|
|000015a0| 6c 75 73 20 74 68 65 20 | 61 6d 6f 72 74 69 7a 65 |lus the |amortize|
|000015b0| 64 20 6d 61 70 20 73 69 | 7a 65 2e 0d 48 65 72 65 |d map si|ze..Here|
|000015c0| 27 73 20 61 6e 20 65 78 | 61 6d 70 6c 65 20 6f 66 |'s an ex|ample of|
|000015d0| 20 61 20 66 72 61 6d 65 | 20 77 69 74 68 20 61 20 | a frame| with a |
|000015e0| 73 68 61 72 65 64 20 6d | 61 70 3a 0d 7b 53 6c 6f |shared m|ap:.{Slo|
|000015f0| 74 31 3a 20 34 32 2c 20 | 53 6c 6f 74 32 3a 20 22 |t1: 42, |Slot2: "|
|00001600| 68 65 6c 6c 6f 22 7d 0d | 57 65 20 68 61 76 65 20 |hello"}.|We have |
|00001610| 61 20 68 65 61 64 65 72 | 20 6f 66 20 31 32 20 62 |a header| of 12 b|
|00001620| 79 74 65 73 2c 20 69 6e | 20 61 64 64 69 74 69 6f |ytes, in| additio|
|00001630| 6e 20 77 65 20 68 61 76 | 65 20 74 77 6f 20 73 6c |n we hav|e two sl|
|00001640| 6f 74 73 20 28 32 20 2a | 20 34 29 2c 20 61 6e 64 |ots (2 *| 4), and|
|00001650| 20 61 64 64 69 74 69 6f | 6e 61 6c 20 31 36 20 62 | additio|nal 16 b|
|00001660| 79 74 65 73 20 66 6f 72 | 20 74 68 65 20 73 69 7a |ytes for| the siz|
|00001670| 65 20 6f 66 20 61 20 6d | 61 70 20 77 69 74 68 20 |e of a m|ap with |
|00001680| 6e 6f 20 73 6c 6f 74 73 | 2c 20 61 6c 6c 20 69 6e |no slots|, all in|
|00001690| 20 61 6c 6c 20 33 36 20 | 62 79 74 65 73 2e 20 57 | all 36 |bytes. W|
|000016a0| 65 20 73 68 6f 75 6c 64 | 20 61 6c 73 6f 20 74 61 |e should| also ta|
|000016b0| 6b 65 20 69 6e 74 6f 20 | 61 63 63 6f 75 6e 74 20 |ke into |account |
|000016c0| 74 68 65 20 73 68 61 72 | 65 64 20 6d 61 70 2c 20 |the shar|ed map, |
|000016d0| 69 6e 20 74 68 65 20 77 | 6f 72 73 74 20 63 61 73 |in the w|orst cas|
|000016e0| 65 20 74 68 65 72 65 27 | 73 20 6f 6e 6c 79 20 6f |e there'|s only o|
|000016f0| 6e 65 20 6f 66 20 74 68 | 65 73 65 20 66 72 61 6d |ne of th|ese fram|
|00001700| 65 20 6f 62 6a 65 63 74 | 73 2c 20 69 6e 20 6f 74 |e object|s, in ot|
|00001710| 68 65 72 20 77 6f 72 64 | 73 20 77 65 20 68 61 76 |her word|s we hav|
|00001720| 65 20 61 64 64 69 74 69 | 6f 6e 61 6c 20 31 36 20 |e additi|onal 16 |
|00001730| 62 79 74 65 73 2e 0d 57 | 68 65 6e 20 64 6f 20 77 |bytes..W|hen do w|
|00001740| 65 20 63 72 65 61 74 65 | 20 6f 62 6a 65 63 74 73 |e create| objects|
|00001750| 20 77 69 74 68 20 61 20 | 73 68 61 72 65 64 20 6d | with a |shared m|
|00001760| 61 70 3f 0d 31 2e 20 57 | 68 65 6e 20 77 65 20 63 |ap?.1. W|hen we c|
|00001770| 6c 6f 6e 65 20 74 68 65 | 20 73 79 73 74 65 6d 20 |lone the| system |
|00001780| 77 69 6c 6c 20 6d 61 6b | 65 20 73 75 72 65 20 74 |will mak|e sure t|
|00001790| 68 61 74 20 74 68 65 20 | 63 6c 6f 6e 65 64 20 6f |hat the |cloned o|
|000017a0| 62 6a 65 63 74 20 75 73 | 65 73 20 74 68 65 20 73 |bject us|es the s|
|000017b0| 61 6d 65 20 6d 61 70 2e | 20 41 20 74 72 69 63 6b |ame map.| A trick|
|000017c0| 20 74 6f 20 6d 61 6b 65 | 20 75 73 65 20 6f 66 20 | to make| use of |
|000017d0| 74 68 69 73 20 69 73 20 | 74 6f 20 63 72 65 61 74 |this is |to creat|
|000017e0| 65 20 61 20 63 6f 6d 6d | 6f 6e 20 74 65 6d 70 6c |e a comm|on templ|
|000017f0| 61 74 65 20 66 72 61 6d | 65 2c 20 61 6e 64 20 77 |ate fram|e, and w|
|00001800| 68 65 6e 20 77 65 20 6e | 65 65 64 20 74 6f 20 63 |hen we n|eed to c|
|00001810| 72 65 61 74 65 20 61 64 | 64 69 74 69 6f 6e 61 6c |reate ad|ditional|
|00001820| 20 66 72 61 6d 65 73 20 | 77 65 20 63 6c 6f 6e 65 | frames |we clone|
|00001830| 20 74 68 69 73 20 74 65 | 6d 70 6c 61 74 65 20 66 | this te|mplate f|
|00001840| 72 61 6d 65 20 6f 76 65 | 72 20 61 6e 64 20 6f 76 |rame ove|r and ov|
|00001850| 65 72 2e 0d 32 2e 20 54 | 68 65 20 73 79 73 74 65 |er..2. T|he syste|
|00001860| 6d 20 77 69 6c 6c 20 6d | 61 6b 65 20 73 75 72 65 |m will m|ake sure|
|00001870| 20 74 68 61 74 20 74 68 | 65 20 66 72 61 6d 65 20 | that th|e frame |
|00001880| 75 73 65 73 20 61 20 73 | 68 61 72 65 64 20 6d 61 |uses a s|hared ma|
|00001890| 70 20 69 66 20 74 68 65 | 20 66 72 61 6d 65 20 69 |p if the| frame i|
|000018a0| 73 20 63 72 65 61 74 65 | 64 20 62 79 20 61 20 61 |s create|d by a a|
|000018b0| 20 66 72 61 6d 65 20 63 | 6f 6e 73 74 72 75 63 74 | frame c|onstruct|
|000018c0| 6f 72 20 65 78 70 72 65 | 73 73 69 6f 6e 20 69 6e |or expre|ssion in|
|000018d0| 20 6d 6f 73 74 20 63 61 | 73 65 73 20 61 20 66 75 | most ca|ses a fu|
|000018e0| 6e 63 74 69 6f 6e 20 74 | 68 61 74 20 72 65 74 75 |nction t|hat retu|
|000018f0| 72 6e 73 20 61 20 66 72 | 61 6d 65 2e 20 54 68 69 |rns a fr|ame. Thi|
|00001900| 73 20 69 73 20 74 68 65 | 20 72 65 61 73 6f 6e 20 |s is the| reason |
|00001910| 77 65 20 75 73 65 20 52 | 65 6c 42 6f 75 6e 64 73 |we use R|elBounds|
|00001920| 20 77 68 65 6e 20 77 65 | 20 63 72 65 61 74 65 20 | when we| create |
|00001930| 74 68 65 20 76 69 65 77 | 42 6f 75 6e 64 73 20 66 |the view|Bounds f|
|00001940| 72 61 6d 65 2c 20 69 6e | 20 6f 74 68 65 72 20 77 |rame, in| other w|
|00001950| 6f 72 64 73 20 74 68 65 | 72 65 27 73 20 6a 75 73 |ords the|re's jus|
|00001960| 74 20 6f 6e 65 20 73 69 | 6e 67 6c 65 20 76 69 65 |t one si|ngle vie|
|00001970| 77 42 6f 75 6e 64 73 20 | 6d 61 70 20 69 6e 20 74 |wBounds |map in t|
|00001980| 68 65 20 73 79 73 74 65 | 6d 2c 20 61 6e 64 20 69 |he syste|m, and i|
|00001990| 74 27 73 20 73 74 6f 72 | 65 64 20 69 6e 73 69 64 |t's stor|ed insid|
|000019a0| 65 20 74 68 65 20 52 4f | 4d 2e 0d 4e 6f 74 65 20 |e the RO|M..Note |
|000019b0| 61 67 61 69 6e 20 74 68 | 61 74 20 74 68 65 73 65 |again th|at these|
|000019c0| 20 66 69 67 75 72 65 73 | 20 61 72 65 20 66 6f 72 | figures| are for|
|000019d0| 20 6f 62 6a 65 63 74 73 | 20 69 6e 20 74 68 65 69 | objects| in thei|
|000019e0| 72 20 72 75 6e 74 69 6d | 65 20 73 74 61 74 65 2c |r runtim|e state,|
|000019f0| 20 72 65 61 64 79 20 66 | 6f 72 20 66 61 73 74 20 | ready f|or fast |
|00001a00| 61 63 63 65 73 73 2e 20 | 4f 62 6a 65 63 74 73 20 |access. |Objects |
|00001a10| 69 6e 20 74 72 61 6e 73 | 69 74 20 6f 72 20 69 6e |in trans|it or in|
|00001a20| 20 73 74 6f 72 61 67 65 | 20 28 70 61 63 6b 61 67 | storage| (packag|
|00001a30| 65 73 29 20 61 72 65 20 | 63 6f 6d 70 72 65 73 73 |es) are |compress|
|00001a40| 65 64 20 69 6e 74 6f 20 | 73 6d 61 6c 6c 65 72 20 |ed into |smaller |
|00001a50| 73 74 72 65 61 6d 20 66 | 6f 72 6d 61 74 73 2e 20 |stream f|ormats. |
|00001a60| 54 68 65 73 65 20 66 69 | 67 75 72 65 73 20 61 72 |These fi|gures ar|
|00001a70| 65 20 6e 65 69 74 68 65 | 72 20 74 72 75 65 20 66 |e neithe|r true f|
|00001a80| 6f 72 20 66 6c 61 74 74 | 65 6e 65 64 20 6f 62 6a |or flatt|ened obj|
|00001a90| 65 63 74 73 20 74 68 61 | 74 20 61 72 65 20 73 65 |ects tha|t are se|
|00001aa0| 6e 74 20 6f 76 65 72 20 | 61 20 63 6f 6d 6d 73 20 |nt over |a comms |
|00001ab0| 65 6e 64 70 6f 69 6e 74 | 2c 20 6e 65 69 74 68 65 |endpoint|, neithe|
|00001ac0| 72 20 74 72 75 65 20 66 | 6f 72 20 6f 62 6a 65 63 |r true f|or objec|
|00001ad0| 74 73 20 73 74 6f 72 65 | 64 20 69 6e 20 73 6f 75 |ts store|d in sou|
|00001ae0| 70 73 2e 0d 53 79 6d 62 | 6f 6c 73 0d 41 73 79 6d |ps..Symb|ols.Asym|
|00001af0| 62 6f 6c 20 69 73 20 61 | 20 66 72 61 6d 65 20 77 |bol is a| frame w|
|00001b00| 69 74 68 20 74 77 6f 20 | 73 6c 6f 74 73 2c 20 6f |ith two |slots, o|
|00001b10| 6e 65 20 70 6f 69 6e 74 | 69 6e 67 20 74 6f 20 61 |ne point|ing to a|
|00001b20| 20 73 74 72 69 6e 67 20 | 63 6f 6e 74 61 69 6e 69 | string |containi|
|00001b30| 6e 67 20 74 68 65 20 6e | 61 6d 65 2c 20 74 68 65 |ng the n|ame, the|
|00001b40| 20 6f 74 68 65 72 20 70 | 6f 69 6e 74 69 6e 67 20 | other p|ointing |
|00001b50| 74 6f 20 74 68 65 20 6e | 65 78 74 20 73 79 6d 62 |to the n|ext symb|
|00001b60| 6f 6c 20 69 6e 20 61 6e | 20 69 6e 74 65 72 6e 61 |ol in an| interna|
|00001b70| 6c 20 20 68 61 73 68 20 | 74 61 62 6c 65 2e 20 20 |l hash |table. |
|00001b80| 53 79 6d 62 6f 6c 73 20 | 73 68 61 72 65 20 6f 6e |Symbols |share on|
|00001b90| 65 20 6d 61 70 2c 20 73 | 6f 20 65 61 63 68 20 73 |e map, s|o each s|
|00001ba0| 79 6d 62 6f 6c 20 6f 63 | 63 75 70 69 65 73 20 31 |ymbol oc|cupies 1|
|00001bb0| 32 2b 32 2a 34 20 3d 20 | 32 30 20 28 72 6f 75 6e |2+2*4 = |20 (roun|
|00001bc0| 64 20 74 6f 20 32 34 29 | 20 62 79 74 65 73 20 66 |d to 24)| bytes f|
|00001bd0| 6f 72 20 74 68 65 20 66 | 72 61 6d 65 20 61 6e 64 |or the f|rame and|
|00001be0| 20 31 32 2b 6c 65 6e 67 | 74 68 20 28 72 6f 75 6e | 12+leng|th (roun|
|00001bf0| 64 65 64 29 20 62 79 74 | 65 73 20 66 6f 72 20 74 |ded) byt|es for t|
|00001c00| 68 65 20 6e 61 6d 65 2c | 20 66 6f 72 20 61 20 74 |he name,| for a t|
|00001c10| 6f 74 61 6c 20 6f 66 20 | 33 36 2b 6c 65 6e 67 74 |otal of |36+lengt|
|00001c20| 68 20 62 79 74 65 73 2e | 0d 41 20 73 79 6d 62 6f |h bytes.|.A symbo|
|00001c30| 6c 20 69 73 20 61 20 62 | 69 6e 61 72 79 20 6f 62 |l is a b|inary ob|
|00001c40| 6a 65 63 74 20 74 68 61 | 74 20 63 6f 6e 74 61 69 |ject tha|t contai|
|00001c50| 6e 73 20 61 20 66 6f 75 | 72 2d 62 79 74 65 20 68 |ns a fou|r-byte h|
|00001c60| 61 73 68 20 76 61 6c 75 | 65 20 61 6e 64 20 74 68 |ash valu|e and th|
|00001c70| 65 20 6e 61 6d 65 20 69 | 73 20 61 20 6e 75 6c 6c |e name i|s a null|
|00001c80| 20 74 65 72 6d 69 6e 61 | 74 65 64 20 41 53 43 49 | termina|ted ASCI|
|00001c90| 49 20 63 68 61 72 61 63 | 74 65 72 20 2e 20 45 61 |I charac|ter . Ea|
|00001ca0| 63 68 20 73 79 6d 62 6f | 6c 20 69 73 20 31 32 20 |ch symbo|l is 12 |
|00001cb0| 28 68 65 61 64 65 72 29 | 20 2b 20 34 20 28 68 61 |(header)| + 4 (ha|
|00001cc0| 73 68 20 76 61 6c 75 65 | 5f 29 20 2b 20 6c 65 6e |sh value|_) + len|
|00001cd0| 67 74 68 20 6f 66 20 6f | 62 6a 65 63 74 20 2b 20 |gth of o|bject + |
|00001ce0| 31 20 62 79 74 65 73 20 | 28 6e 75 6c 6c 20 74 65 |1 bytes |(null te|
|00001cf0| 72 6d 69 6e 61 74 69 6f | 6e 20 41 53 43 49 49 20 |rminatio|n ASCII |
|00001d00| 63 68 61 72 29 2e 0d 50 | 4c 41 59 20 43 41 54 43 |char)..P|LAY CATC|
|00001d10| 48 20 2d 20 4e 45 57 54 | 4f 4e 53 43 52 49 50 54 |H - NEWT|ONSCRIPT|
|00001d20| 20 45 58 43 45 50 54 49 | 4f 4e 53 0d 28 39 2f 31 | EXCEPTI|ONS.(9/1|
|00001d30| 35 2f 39 33 29 20 28 4f | 62 73 6f 6c 65 74 65 64 |5/93) (O|bsoleted|
|00001d40| 20 62 79 20 4e 53 20 47 | 75 69 64 65 20 31 2e 30 | by NS G|uide 1.0|
|00001d50| 20 66 69 6e 61 6c 20 64 | 6f 63 73 29 0d 49 6e 74 | final d|ocs).Int|
|00001d60| 72 6f 64 75 63 74 69 6f | 6e 0d 54 68 65 20 4e 65 |roductio|n.The Ne|
|00001d70| 77 74 6f 6e 53 63 72 69 | 70 74 20 65 78 63 65 70 |wtonScri|pt excep|
|00001d80| 74 69 6f 6e 20 73 79 73 | 74 65 6d 20 70 72 6f 76 |tion sys|tem prov|
|00001d90| 69 64 65 73 20 61 20 73 | 74 72 75 63 74 75 72 65 |ides a s|tructure|
|00001da0| 64 20 77 61 79 20 66 6f | 72 20 61 20 6d 6f 64 75 |d way fo|r a modu|
|00001db0| 6c 65 20 74 6f 20 72 65 | 70 6f 72 74 20 61 20 66 |le to re|port a f|
|00001dc0| 61 69 6c 75 72 65 20 74 | 6f 20 61 6e 6f 74 68 65 |ailure t|o anothe|
|00001dd0| 72 20 6d 6f 64 75 6c 65 | 2e 20 20 49 74 20 63 6f |r module|. It co|
|00001de0| 6d 6d 75 6e 69 63 61 74 | 65 73 20 74 68 65 20 74 |mmunicat|es the t|
|00001df0| 79 70 65 20 6f 66 20 74 | 68 65 20 66 61 69 6c 75 |ype of t|he failu|
|00001e00| 72 65 2c 20 61 6e 64 20 | 61 6c 6c 6f 77 73 20 28 |re, and |allows (|
|00001e10| 6f 70 74 69 6f 6e 61 6c | 6c 79 29 20 74 72 61 6e |optional|ly) tran|
|00001e20| 73 6d 69 73 73 69 6f 6e | 20 6f 66 20 64 61 74 61 |smission| of data|
|00001e30| 20 74 68 61 74 20 6d 61 | 79 20 65 78 70 6c 61 69 | that ma|y explai|
|00001e40| 6e 20 74 68 65 20 72 65 | 61 73 6f 6e 20 66 6f 72 |n the re|ason for|
|00001e50| 20 74 68 65 20 66 61 69 | 6c 75 72 65 2e 20 20 54 | the fai|lure. T|
|00001e60| 68 65 20 4e 65 77 74 6f | 6e 53 63 72 69 70 74 20 |he Newto|nScript |
|00001e70| 69 6d 70 6c 65 6d 65 6e | 74 69 6f 6e 20 75 73 65 |implemen|tion use|
|00001e80| 73 20 74 68 65 20 65 78 | 63 65 70 74 69 6f 6e 20 |s the ex|ception |
|00001e90| 73 79 73 74 65 6d 20 74 | 6f 20 72 65 70 6f 72 74 |system t|o report|
|00001ea0| 20 65 72 72 6f 72 73 20 | 28 66 6f 72 20 65 78 61 | errors |(for exa|
|00001eb0| 6d 70 6c 65 2c 20 65 72 | 72 6f 72 73 20 69 6e 20 |mple, er|rors in |
|00001ec0| 61 6e 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 2c 20 |an appli|cation, |
|00001ed0| 66 61 69 6c 75 72 65 73 | 20 64 75 65 20 74 6f 20 |failures| due to |
|00001ee0| 6c 61 63 6b 20 6f 66 20 | 72 65 73 6f 75 72 63 65 |lack of |resource|
|00001ef0| 73 2c 20 6f 72 20 69 6e | 74 65 72 6e 61 6c 20 65 |s, or in|ternal e|
|00001f00| 72 72 6f 72 73 29 2e 20 | 20 44 65 76 65 6c 6f 70 |rrors). | Develop|
|00001f10| 65 72 73 20 63 61 6e 20 | 75 73 65 20 74 68 65 20 |ers can |use the |
|00001f20| 65 78 63 65 70 74 69 6f | 6e 20 73 79 73 74 65 6d |exceptio|n system|
|00001f30| 20 74 6f 20 63 6f 6d 6d | 75 6e 69 63 61 74 65 20 | to comm|unicate |
|00001f40| 65 72 72 6f 72 73 20 62 | 65 74 77 65 65 6e 20 64 |errors b|etween d|
|00001f50| 69 66 66 65 72 65 6e 74 | 20 6d 6f 64 75 6c 65 73 |ifferent| modules|
|00001f60| 20 69 6e 20 61 6e 20 61 | 70 70 6c 69 63 61 74 69 | in an a|pplicati|
|00001f70| 6f 6e 2e 0d 42 61 73 69 | 63 20 53 79 6e 74 61 78 |on..Basi|c Syntax|
|00001f80| 0d 54 68 65 20 45 78 63 | 65 70 74 69 6f 6e 20 68 |.The Exc|eption h|
|00001f90| 61 6e 64 6c 69 6e 67 20 | 69 73 20 62 61 73 65 64 |andling |is based|
|00001fa0| 20 6f 6e 20 61 20 74 72 | 79 20 62 6c 6f 63 6b 2c | on a tr|y block,|
|00001fb0| 20 61 6e 64 20 69 66 20 | 61 6e 20 65 78 63 65 70 | and if |an excep|
|00001fc0| 74 69 6f 6e 20 69 73 20 | 74 68 72 6f 77 6e 20 66 |tion is |thrown f|
|00001fd0| 72 6f 6d 20 73 6f 6d 65 | 77 68 65 72 65 2c 20 74 |rom some|where, t|
|00001fe0| 68 65 20 63 6f 64 65 20 | 73 68 6f 75 6c 64 20 63 |he code |should c|
|00001ff0| 61 74 63 68 20 74 68 69 | 73 20 77 69 74 68 20 61 |atch thi|s with a|
|00002000| 20 73 70 65 63 69 61 6c | 20 6f 6e 45 78 63 65 70 | special| onExcep|
|00002010| 74 69 6f 6e 20 62 6c 6f | 63 6b 2e 0d 54 72 79 20 |tion blo|ck..Try |
|00002020| 53 74 61 74 65 6d 65 6e | 74 73 0d 54 68 65 20 67 |Statemen|ts.The g|
|00002030| 65 6e 65 72 61 6c 20 66 | 6f 72 6d 61 74 20 6f 66 |eneral f|ormat of|
|00002040| 20 74 68 65 20 74 72 79 | 20 73 74 61 74 65 6d 65 | the try| stateme|
|00002050| 6e 74 20 69 73 3a 0d 74 | 72 79 0d 09 3c 73 74 61 |nt is:.t|ry..<sta|
|00002060| 74 65 6d 65 6e 74 20 6c | 69 73 74 3e 0d 6f 6e 65 |tement l|ist>.one|
|00002070| 78 63 65 70 74 69 6f 6e | 20 3c 65 78 63 65 70 74 |xception| <except|
|00002080| 69 6f 6e 20 73 79 6d 62 | 6f 6c 3e 20 64 6f 0d 09 |ion symb|ol> do..|
|00002090| 3c 73 74 61 74 65 6d 65 | 6e 74 3e 0d 6f 6e 65 78 |<stateme|nt>.onex|
|000020a0| 63 65 70 74 69 6f 6e 20 | 3c 65 78 63 65 70 74 69 |ception |<excepti|
|000020b0| 6f 6e 20 73 79 6d 62 6f | 6c 3e 20 64 6f 0d 09 3c |on symbo|l> do..<|
|000020c0| 73 74 61 74 65 6d 65 6e | 74 3e 0d 2e 2e 2e 0d 41 |statemen|t>.....A|
|000020d0| 6e 20 65 78 61 6d 70 6c | 65 20 6f 66 20 74 68 69 |n exampl|e of thi|
|000020e0| 73 20 6d 69 67 68 74 20 | 62 65 3a 0d 74 72 79 0d |s might |be:.try.|
|000020f0| 62 65 67 69 6e 0d 09 2f | 2f 20 63 72 65 61 74 65 |begin../|/ create|
|00002100| 20 65 6e 74 72 69 65 73 | 20 61 6e 64 20 73 74 6f | entries| and sto|
|00002110| 72 65 20 74 68 65 6d 20 | 74 6f 20 73 6f 75 70 73 |re them |to soups|
|00002120| 0d 65 6e 64 0d 6f 6e 65 | 78 63 65 70 74 69 6f 6e |.end.one|xception|
|00002130| 20 7c 65 78 74 2e 65 78 | 2e 73 74 6f 72 65 2e 65 | |ext.ex|.store.e|
|00002140| 72 72 7c 20 64 6f 0d 62 | 65 67 69 6e 0d 09 2f 2f |rr| do.b|egin..//|
|00002150| 20 70 72 6f 62 6c 65 6d | 73 20 77 69 74 68 20 74 | problem|s with t|
|00002160| 68 65 20 73 74 6f 72 65 | 2c 20 6d 6f 73 74 20 6c |he store|, most l|
|00002170| 69 6b 65 6c 79 20 6e 6f | 74 20 65 6e 6f 75 67 68 |ikely no|t enough|
|00002180| 20 6d 65 6d 6f 72 79 0d | 09 2f 2f 20 64 6f 20 73 | memory.|.// do s|
|00002190| 6f 6d 65 74 68 69 6e 67 | 0d 65 6e 64 0d 54 68 65 |omething|.end.The|
|000021a0| 20 3c 65 78 63 65 70 74 | 69 6f 6e 20 73 79 6d 62 | <except|ion symb|
|000021b0| 6f 6c 3e 73 20 20 6d 75 | 73 74 20 62 65 20 73 69 |ol>s mu|st be si|
|000021c0| 6e 67 6c 65 20 70 61 72 | 74 20 65 78 63 65 70 74 |ngle par|t except|
|000021d0| 69 6f 6e 20 73 79 6d 62 | 6f 6c 73 2e 20 44 65 74 |ion symb|ols. Det|
|000021e0| 61 69 6c 73 20 61 62 6f | 75 74 20 65 78 63 65 70 |ails abo|ut excep|
|000021f0| 74 69 6f 6e 20 73 79 6d | 62 6f 6c 73 20 d1 20 74 |tion sym|bols . t|
|00002200| 68 61 74 20 69 73 2c 20 | 20 77 68 61 74 20 6d 75 |hat is, | what mu|
|00002210| 6c 74 69 70 6c 65 20 70 | 61 72 74 73 20 6d 65 61 |ltiple p|arts mea|
|00002220| 6e 20 d1 20 20 61 72 65 | 20 64 69 73 63 75 73 73 |n . are| discuss|
|00002230| 65 64 20 62 65 6c 6f 77 | 2e 0d 4f 6e 65 20 6f 72 |ed below|..One or|
|00002240| 20 6d 6f 72 65 20 6f 6e | 65 78 63 65 70 74 69 6f | more on|exceptio|
|00002250| 6e 20 63 6c 61 75 73 65 | 73 20 61 72 65 20 61 6c |n clause|s are al|
|00002260| 6c 6f 77 65 64 2e 20 54 | 68 65 20 74 72 79 20 73 |lowed. T|he try s|
|00002270| 74 61 74 65 6d 65 6e 74 | 20 65 78 65 63 75 74 65 |tatement| execute|
|00002280| 73 20 3c 73 74 61 74 65 | 6d 65 6e 74 20 6c 69 73 |s <state|ment lis|
|00002290| 74 3e 2e 20 49 66 20 6e | 6f 20 65 78 63 65 70 74 |t>. If n|o except|
|000022a0| 69 6f 6e 73 20 61 72 65 | 20 74 68 72 6f 77 6e 20 |ions are| thrown |
|000022b0| 69 6e 20 74 68 65 20 70 | 72 6f 63 65 73 73 2c 20 |in the p|rocess, |
|000022c0| 74 68 65 6e 20 74 68 65 | 20 76 61 6c 75 65 20 6f |then the| value o|
|000022d0| 66 20 74 68 65 20 74 72 | 79 20 73 74 61 74 65 6d |f the tr|y statem|
|000022e0| 65 6e 74 20 69 73 20 74 | 68 65 20 76 61 6c 75 65 |ent is t|he value|
|000022f0| 20 6f 66 20 74 68 65 20 | 6c 61 73 74 20 73 74 61 | of the |last sta|
|00002300| 74 65 6d 65 6e 74 20 69 | 6e 20 3c 73 74 61 74 65 |tement i|n <state|
|00002310| 6d 65 6e 74 20 6c 69 73 | 74 3e 20 61 6e 64 20 74 |ment lis|t> and t|
|00002320| 68 65 20 6f 6e 65 78 63 | 65 70 74 69 6f 6e 20 63 |he onexc|eption c|
|00002330| 6c 61 75 73 65 73 20 61 | 72 65 20 6e 65 76 65 72 |lauses a|re never|
|00002340| 20 65 78 65 63 75 74 65 | 64 2e 0d 49 66 20 64 75 | execute|d..If du|
|00002350| 72 69 6e 67 20 65 78 65 | 63 75 74 69 6f 6e 20 6f |ring exe|cution o|
|00002360| 66 20 3c 73 74 61 74 65 | 6d 65 6e 74 20 6c 69 73 |f <state|ment lis|
|00002370| 74 3e 20 61 6e 20 65 78 | 63 65 70 74 69 6f 6e 20 |t> an ex|ception |
|00002380| 69 73 20 74 68 72 6f 77 | 6e 2c 20 74 68 65 6e 20 |is throw|n, then |
|00002390| 74 68 65 20 65 78 65 63 | 75 74 69 6f 6e 20 6f 66 |the exec|ution of|
|000023a0| 20 3c 73 74 61 74 65 6d | 65 6e 74 20 6c 69 73 74 | <statem|ent list|
|000023b0| 3e 20 73 74 6f 70 73 20 | 61 6e 64 20 63 6f 6e 74 |> stops |and cont|
|000023c0| 72 6f 6c 20 69 73 20 74 | 72 61 6e 73 66 65 72 72 |rol is t|ransferr|
|000023d0| 65 64 20 74 6f 20 6f 6e | 65 20 6f 66 20 74 68 65 |ed to on|e of the|
|000023e0| 20 6f 6e 65 78 63 65 70 | 74 69 6f 6e 20 63 6c 61 | onexcep|tion cla|
|000023f0| 75 73 65 73 2e 20 57 68 | 65 6e 20 61 6e 20 65 78 |uses. Wh|en an ex|
|00002400| 63 65 70 74 69 6f 6e 2c | 20 58 2c 20 69 73 20 72 |ception,| X, is r|
|00002410| 61 69 73 65 64 2c 20 74 | 68 65 20 6f 6e 65 78 63 |aised, t|he onexc|
|00002420| 65 70 74 69 6f 6e 20 63 | 6c 61 75 73 65 73 20 6f |eption c|lauses o|
|00002430| 66 20 74 68 65 20 74 72 | 79 20 73 74 61 74 65 6d |f the tr|y statem|
|00002440| 65 6e 74 20 61 72 65 20 | 65 78 61 6d 69 6e 65 64 |ent are |examined|
|00002450| 20 69 6e 20 6f 72 64 65 | 72 2e 20 54 68 65 20 66 | in orde|r. The f|
|00002460| 69 72 73 74 20 63 6c 61 | 75 73 65 20 77 68 6f 73 |irst cla|use whos|
|00002470| 65 20 3c 65 78 63 65 70 | 74 69 6f 6e 20 73 79 6d |e <excep|tion sym|
|00002480| 62 6f 6c 3e 20 69 73 20 | 61 20 70 72 65 66 69 78 |bol> is |a prefix|
|00002490| 20 6f 66 20 61 6e 79 20 | 6f 66 20 58 27 73 20 70 | of any |of X's p|
|000024a0| 61 72 74 73 20 69 73 20 | 65 78 65 63 75 74 65 64 |arts is |executed|
|000024b0| 20 61 6e 64 20 69 74 73 | 20 3c 73 74 61 74 65 6d | and its| <statem|
|000024c0| 65 6e 74 3e 20 76 61 6c | 75 65 20 62 65 63 6f 6d |ent> val|ue becom|
|000024d0| 65 73 20 74 68 65 20 76 | 61 6c 75 65 20 6f 66 20 |es the v|alue of |
|000024e0| 74 68 65 20 74 72 79 20 | 73 74 61 74 65 6d 65 6e |the try |statemen|
|000024f0| 74 2e 0d 49 66 20 6e 6f | 20 6f 6e 65 78 63 65 70 |t..If no| onexcep|
|00002500| 74 69 6f 6e 20 63 6c 61 | 75 73 65 20 6d 61 74 63 |tion cla|use matc|
|00002510| 68 65 73 20 74 68 65 20 | 65 78 63 65 70 74 69 6f |hes the |exceptio|
|00002520| 6e 2c 20 74 68 65 6e 20 | 74 68 65 20 65 78 63 65 |n, then |the exce|
|00002530| 70 74 69 6f 6e 20 69 73 | 20 70 61 73 73 65 64 20 |ption is| passed |
|00002540| 74 6f 20 74 68 65 20 6e | 65 78 74 20 65 6e 63 6c |to the n|ext encl|
|00002550| 6f 73 69 6e 67 20 74 72 | 79 20 73 74 61 74 65 6d |osing tr|y statem|
|00002560| 65 6e 74 20 66 6f 72 20 | 70 72 6f 63 65 73 73 69 |ent for |processi|
|00002570| 6e 67 2e 20 49 6e 20 61 | 20 4e 65 77 74 6f 6e 20 |ng. In a| Newton |
|00002580| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2c 20 74 68 65 |applicat|ion, the|
|00002590| 20 65 78 63 65 70 74 69 | 6f 6e 20 77 69 6c 6c 20 | excepti|on will |
|000025a0| 75 6c 74 69 6d 61 74 65 | 6c 79 20 62 65 20 68 61 |ultimate|ly be ha|
|000025b0| 6e 64 6c 65 64 20 62 79 | 20 74 68 65 20 76 69 65 |ndled by| the vie|
|000025c0| 77 20 73 79 73 74 65 6d | 20 28 70 75 74 74 69 6e |w system| (puttin|
|000025d0| 67 20 75 70 20 61 6e 20 | 65 72 72 6f 72 20 64 69 |g up an |error di|
|000025e0| 61 6c 6f 67 20 62 6f 78 | 29 20 69 66 20 79 6f 75 |alog box|) if you|
|000025f0| 72 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 64 6f |r applic|ation do|
|00002600| 65 73 6e 27 74 20 63 61 | 74 63 68 20 69 74 2e 0d |esn't ca|tch it..|
|00002610| 4e 4f 54 45 3a 20 20 49 | 74 20 69 73 20 69 6d 70 |NOTE: I|t is imp|
|00002620| 6f 72 74 61 6e 74 20 74 | 68 61 74 20 74 68 65 20 |ortant t|hat the |
|00002630| 73 65 61 72 63 68 20 66 | 6f 72 20 61 20 6d 61 74 |search f|or a mat|
|00002640| 63 68 69 6e 67 20 6f 6e | 65 78 63 65 70 74 69 6f |ching on|exceptio|
|00002650| 6e 20 63 6c 61 75 73 65 | 20 75 73 65 73 20 64 79 |n clause| uses dy|
|00002660| 6e 61 6d 69 63 20 73 63 | 6f 70 69 6e 67 2c 20 6e |namic sc|oping, n|
|00002670| 6f 74 20 6c 65 78 69 63 | 61 6c 20 73 63 6f 70 69 |ot lexic|al scopi|
|00002680| 6e 67 2e 0d 53 69 6e 63 | 65 20 61 6c 6c 20 65 78 |ng..Sinc|e all ex|
|00002690| 63 65 70 74 69 6f 6e 73 | 20 68 61 76 65 20 61 6e |ceptions| have an|
|000026a0| 20 65 76 74 2e 65 78 20 | 70 61 72 74 2c 20 61 6e | evt.ex |part, an|
|000026b0| 20 65 78 63 65 70 74 69 | 6f 6e 20 63 6c 61 75 73 | excepti|on claus|
|000026c0| 65 20 77 69 74 68 20 65 | 76 74 2e 65 78 20 61 73 |e with e|vt.ex as|
|000026d0| 20 69 74 73 20 73 79 6d | 62 6f 6c 20 77 69 6c 6c | its sym|bol will|
|000026e0| 20 63 61 74 63 68 20 61 | 6e 79 20 65 78 63 65 70 | catch a|ny excep|
|000026f0| 74 69 6f 6e 2e 20 28 53 | 65 65 20 74 68 65 20 66 |tion. (S|ee the f|
|00002700| 6f 6c 6c 6f 77 69 6e 67 | 20 73 65 63 74 69 6f 6e |ollowing| section|
|00002710| 20 66 6f 72 20 61 20 64 | 65 73 63 72 69 70 74 69 | for a d|escripti|
|00002720| 6f 6e 20 6f 66 20 22 70 | 61 72 74 73 22 2e 29 20 |on of "p|arts".) |
|00002730| 49 66 20 79 6f 75 72 20 | 74 72 79 20 73 74 61 74 |If your |try stat|
|00002740| 65 6d 65 6e 74 20 68 61 | 73 20 61 6e 20 65 76 74 |ement ha|s an evt|
|00002750| 2e 65 78 20 63 6c 61 75 | 73 65 2c 20 20 69 74 20 |.ex clau|se, it |
|00002760| 73 68 6f 75 6c 64 20 62 | 65 20 6c 61 73 74 2c 20 |should b|e last, |
|00002770| 73 69 6e 63 65 20 6f 6e | 65 78 63 65 70 74 69 6f |since on|exceptio|
|00002780| 6e 20 63 6c 61 75 73 65 | 73 20 6f 63 63 75 72 69 |n clause|s occuri|
|00002790| 6e 67 20 61 66 74 65 72 | 20 69 74 20 77 69 6c 6c |ng after| it will|
|000027a0| 20 6e 65 76 65 72 20 62 | 65 20 65 78 65 63 75 74 | never b|e execut|
|000027b0| 65 64 2e 20 49 6e 20 67 | 65 6e 65 72 61 6c 2c 20 |ed. In g|eneral, |
|000027c0| 79 6f 75 20 73 68 6f 75 | 6c 64 20 6f 72 64 65 72 |you shou|ld order|
|000027d0| 20 79 6f 75 72 20 6f 6e | 65 78 63 65 70 74 69 6f | your on|exceptio|
|000027e0| 6e 20 63 6c 61 75 73 65 | 73 20 66 72 6f 6d 20 6d |n clause|s from m|
|000027f0| 6f 73 74 20 73 70 65 63 | 69 66 69 63 20 74 6f 20 |ost spec|ific to |
|00002800| 6c 65 61 73 74 20 73 70 | 65 63 69 66 69 63 2e 0d |least sp|ecific..|
|00002810| 45 78 63 65 70 74 69 6f | 6e 20 53 79 6d 62 6f 6c |Exceptio|n Symbol|
|00002820| 73 0d 45 78 63 65 70 74 | 69 6f 6e 73 20 68 61 76 |s.Except|ions hav|
|00002830| 65 20 6e 61 6d 65 73 20 | 77 68 69 63 68 20 61 72 |e names |which ar|
|00002840| 65 20 73 79 6d 62 6f 6c | 73 2e 20 20 54 68 65 73 |e symbol|s. Thes|
|00002850| 65 20 73 79 6d 62 6f 6c | 73 20 68 61 76 65 20 61 |e symbol|s have a|
|00002860| 20 70 61 72 74 69 63 75 | 6c 61 72 20 66 6f 72 6d | particu|lar form|
|00002870| 61 74 20 77 68 69 63 68 | 20 6d 75 73 74 20 62 65 |at which| must be|
|00002880| 20 61 64 68 65 72 65 64 | 20 74 6f 2e 20 20 41 6e | adhered| to. An|
|00002890| 20 65 78 63 65 70 74 69 | 6f 6e 20 6e 61 6d 65 20 | excepti|on name |
|000028a0| 63 6f 6e 73 69 73 74 73 | 20 6f 66 20 6f 6e 65 20 |consists| of one |
|000028b0| 6f 72 20 6d 6f 72 65 20 | 70 61 72 74 73 20 73 65 |or more |parts se|
|000028c0| 70 61 72 61 74 65 64 20 | 62 79 20 73 65 6d 69 2d |parated |by semi-|
|000028d0| 63 6f 6c 6f 6e 73 2e 20 | 20 45 61 63 68 20 70 61 |colons. | Each pa|
|000028e0| 72 74 20 69 73 20 61 20 | 73 74 72 75 63 74 75 72 |rt is a |structur|
|000028f0| 65 64 20 6e 61 6d 65 20 | 62 65 67 69 6e 6e 69 6e |ed name |beginnin|
|00002900| 67 20 77 69 74 68 20 65 | 76 74 2e 65 78 2e 20 0d |g with e|vt.ex. .|
|00002910| 41 20 20 66 65 77 20 66 | 61 63 74 73 20 61 62 6f |A few f|acts abo|
|00002920| 75 74 20 65 78 63 65 70 | 74 69 6f 6e 20 73 79 6d |ut excep|tion sym|
|00002930| 62 6f 6c 73 3a 0d 09 a5 | 20 54 68 65 79 20 63 61 |bols:...| They ca|
|00002940| 6e 20 68 61 76 65 20 61 | 73 20 6d 61 6e 79 20 61 |n have a|s many a|
|00002950| 73 20 31 32 37 20 63 68 | 61 72 61 63 74 65 72 73 |s 127 ch|aracters|
|00002960| 2e 0d 09 a5 20 54 68 65 | 79 20 63 61 6e 20 63 6f |.... The|y can co|
|00002970| 6e 74 61 69 6e 20 70 65 | 72 69 6f 64 73 2c 20 73 |ntain pe|riods, s|
|00002980| 6f 20 74 68 65 20 73 79 | 6d 62 6f 6c 73 20 6d 75 |o the sy|mbols mu|
|00002990| 73 74 20 62 65 20 65 6e | 63 6c 6f 73 65 64 20 69 |st be en|closed i|
|000029a0| 6e 20 76 65 72 74 69 63 | 61 6c 20 62 61 72 73 20 |n vertic|al bars |
|000029b0| 28 7c 27 73 29 0d 09 a5 | 20 54 68 65 79 20 63 61 |(|'s)...| They ca|
|000029c0| 6e 20 68 61 76 65 20 6d | 75 6c 74 69 70 6c 65 20 |n have m|ultiple |
|000029d0| 70 61 72 74 73 2c 20 73 | 65 70 61 72 61 74 65 64 |parts, s|eparated|
|000029e0| 20 62 79 20 73 65 6d 69 | 2d 63 6f 6c 6f 6e 73 2e | by semi|-colons.|
|000029f0| 0d 09 a5 20 54 68 65 79 | 20 6d 75 73 74 20 68 61 |... They| must ha|
|00002a00| 76 65 20 61 20 70 61 72 | 74 20 73 74 61 72 74 69 |ve a par|t starti|
|00002a10| 6e 67 20 77 69 74 68 20 | 65 76 74 2e 65 78 2e 0d |ng with |evt.ex..|
|00002a20| 54 68 65 20 73 69 6d 70 | 6c 65 73 74 20 70 6f 73 |The simp|lest pos|
|00002a30| 73 69 62 6c 65 20 65 78 | 63 65 70 74 69 6f 6e 20 |sible ex|ception |
|00002a40| 73 79 6d 62 6f 6c 20 69 | 73 20 7c 65 76 74 2e 65 |symbol i|s |evt.e|
|00002a50| 78 7c 2e 20 41 6e 20 65 | 78 61 6d 70 6c 65 20 6f |x|. An e|xample o|
|00002a60| 66 20 61 6e 20 65 78 63 | 65 70 74 69 6f 6e 20 73 |f an exc|eption s|
|00002a70| 79 6d 62 6f 6c 20 77 69 | 74 68 20 74 77 6f 20 70 |ymbol wi|th two p|
|00002a80| 61 72 74 73 20 77 6f 75 | 6c 64 20 62 65 20 27 7c |arts wou|ld be '||
|00002a90| 65 76 74 2e 65 78 3b 74 | 79 70 65 2e 72 65 66 7c |evt.ex;t|ype.ref||
|00002aa0| 2e 20 20 53 6f 6d 65 20 | 6d 6f 72 65 20 65 78 61 |. Some |more exa|
|00002ab0| 6d 70 6c 65 73 3a 20 27 | 7c 65 76 74 2e 65 78 2e |mples: '||evt.ex.|
|00002ac0| 64 69 76 30 7c 2c 20 27 | 7c 65 76 74 2e 65 78 2e |div0|, '||evt.ex.|
|00002ad0| 66 72 2e 69 6e 74 72 70 | 3b 74 79 70 65 2e 72 65 |fr.intrp|;type.re|
|00002ae0| 66 2e 66 72 61 6d 65 7c | 2e 0d 45 78 63 65 70 74 |f.frame||..Except|
|00002af0| 69 6f 6e 20 46 72 61 6d | 65 73 0d 41 73 73 6f 63 |ion Fram|es.Assoc|
|00002b00| 69 61 74 65 64 20 77 69 | 74 68 20 65 76 65 72 79 |iated wi|th every|
|00002b10| 20 65 78 63 65 70 74 69 | 6f 6e 20 69 73 20 61 6e | excepti|on is an|
|00002b20| 20 65 78 63 65 70 74 69 | 6f 6e 20 66 72 61 6d 65 | excepti|on frame|
|00002b30| 2e 20 57 68 65 6e 20 68 | 61 6e 64 6c 69 6e 67 20 |. When h|andling |
|00002b40| 61 6e 20 65 78 63 65 70 | 74 69 6f 6e 20 79 6f 75 |an excep|tion you|
|00002b50| 20 63 61 6e 20 67 65 74 | 20 74 68 69 73 20 66 72 | can get| this fr|
|00002b60| 61 6d 65 20 75 73 69 6e | 67 20 74 68 65 20 67 6c |ame usin|g the gl|
|00002b70| 6f 62 61 6c 20 66 75 6e | 63 74 69 6f 6e 2c 20 43 |obal fun|ction, C|
|00002b80| 75 72 72 65 6e 74 45 78 | 63 65 70 74 69 6f 6e 28 |urrentEx|ception(|
|00002b90| 29 2e 20 41 6e 20 65 78 | 63 65 70 74 69 6f 6e 20 |). An ex|ception |
|00002ba0| 66 72 61 6d 65 20 61 6c | 77 61 79 73 20 68 61 73 |frame al|ways has|
|00002bb0| 20 61 20 6e 61 6d 65 20 | 73 6c 6f 74 20 77 68 69 | a name |slot whi|
|00002bc0| 63 68 20 63 6f 6e 74 61 | 69 6e 73 20 74 68 65 20 |ch conta|ins the |
|00002bd0| 65 78 63 65 70 74 69 6f | 6e 20 73 79 6d 62 6f 6c |exceptio|n symbol|
|00002be0| 2e 20 49 74 20 77 69 6c | 6c 20 63 6f 6e 74 61 69 |. It wil|l contai|
|00002bf0| 6e 20 6f 6e 65 20 6f 74 | 68 65 72 20 73 6c 6f 74 |n one ot|her slot|
|00002c00| 20 77 68 6f 73 65 20 6e | 61 6d 65 20 61 6e 64 20 | whose n|ame and |
|00002c10| 63 6f 6e 74 65 6e 74 73 | 20 64 65 70 65 6e 64 20 |contents| depend |
|00002c20| 6f 6e 20 74 68 65 20 74 | 79 70 65 20 6f 66 20 65 |on the t|ype of e|
|00002c30| 78 63 65 70 74 69 6f 6e | 20 61 73 20 66 6f 6c 6c |xception| as foll|
|00002c40| 6f 77 73 3a 20 28 74 68 | 69 73 20 69 6e 66 6f 20 |ows: (th|is info |
|00002c50| 69 73 20 73 75 6d 6d 61 | 72 69 7a 65 64 20 6f 6e |is summa|rized on|
|00002c60| 20 74 68 65 20 4e 53 20 | 51 75 69 63 6b 20 52 65 | the NS |Quick Re|
|00002c70| 66 20 43 61 72 64 29 0d | a5 20 69 66 20 20 74 79 |f Card).|. if ty|
|00002c80| 70 65 2e 72 65 66 20 69 | 73 20 61 20 70 72 65 66 |pe.ref i|s a pref|
|00002c90| 69 78 20 69 6e 20 74 68 | 65 20 65 78 63 65 70 74 |ix in th|e except|
|00002ca0| 69 6f 6e 20 73 79 6d 62 | 6f 6c 2c 20 74 68 65 6e |ion symb|ol, then|
|00002cb0| 20 74 68 65 20 6f 74 68 | 65 72 20 73 6c 6f 74 20 | the oth|er slot |
|00002cc0| 77 69 6c 6c 20 62 65 20 | 63 61 6c 6c 65 64 20 64 |will be |called d|
|00002cd0| 61 74 61 20 61 6e 64 20 | 63 61 6e 20 63 6f 6e 74 |ata and |can cont|
|00002ce0| 61 69 6e 20 61 6e 79 74 | 68 69 6e 67 2e 0d 7c 65 |ain anyt|hing..|e|
|00002cf0| 76 74 2e 65 78 3b 74 79 | 70 65 2e 72 65 66 7c 3a |vt.ex;ty|pe.ref|:|
|00002d00| 20 7b 6e 61 6d 65 3a 20 | 3c 73 74 72 69 6e 67 3e | {name: |<string>|
|00002d10| 2c 20 64 61 74 61 3a 20 | 3c 66 72 61 6d 65 3e 7d |, data: |<frame>}|
|00002d20| 0d 45 78 3a 20 7b 6e 61 | 6d 65 3a 20 22 74 68 65 |.Ex: {na|me: "the|
|00002d30| 20 6c 6c 61 6d 61 20 65 | 78 63 65 70 74 69 6f 6e | llama e|xception|
|00002d40| 22 2c 20 64 61 74 61 20 | 3a 20 7b 74 79 70 65 3a |", data |: {type:|
|00002d50| 20 27 69 6e 6b 61 2c 20 | 73 69 7a 65 3a 20 34 32 | 'inka, |size: 42|
|00002d60| 2c 20 77 65 69 67 68 74 | 3a 20 31 37 37 7d 7d 0d |, weight|: 177}}.|
|00002d70| a5 20 69 66 20 65 76 74 | 2e 65 78 2e 6d 73 67 20 |. if evt|.ex.msg |
|00002d80| 69 73 20 61 20 70 72 65 | 66 69 78 20 69 6e 20 74 |is a pre|fix in t|
|00002d90| 68 65 20 65 78 63 65 70 | 74 69 6f 6e 20 73 79 6d |he excep|tion sym|
|00002da0| 62 6f 6c 2c 20 74 68 65 | 6e 20 74 68 65 20 6f 74 |bol, the|n the ot|
|00002db0| 68 65 72 20 73 6c 6f 74 | 20 77 69 6c 6c 20 62 65 |her slot| will be|
|00002dc0| 20 63 61 6c 6c 65 64 20 | 6d 65 73 73 61 67 65 20 | called |message |
|00002dd0| 61 6e 64 20 63 6f 6e 74 | 61 69 6e 20 61 20 73 74 |and cont|ain a st|
|00002de0| 72 69 6e 67 0d 7c 65 76 | 74 2e 65 78 2e 6d 73 67 |ring.|ev|t.ex.msg|
|00002df0| 7c 3a 20 7b 6e 61 6d 65 | 3a 20 3c 73 74 72 69 6e ||: {name|: <strin|
|00002e00| 67 3e 2c 20 6d 65 73 73 | 61 67 65 3a 20 3c 73 74 |g>, mess|age: <st|
|00002e10| 72 69 6e 67 3e 7d 0d 45 | 78 3a 20 7b 6e 61 6d 65 |ring>}.E|x: {name|
|00002e20| 3a 20 22 48 6f 20 68 6f | 20 65 78 63 65 70 74 69 |: "Ho ho| excepti|
|00002e30| 6f 6e 22 2c 20 6d 65 73 | 73 61 67 65 3a 20 22 59 |on", mes|sage: "Y|
|00002e40| 6f 75 20 68 61 76 65 20 | 61 20 73 65 72 69 6f 75 |ou have |a seriou|
|00002e50| 73 20 70 72 6f 62 6c 65 | 6d 2c 20 6d 61 74 65 22 |s proble|m, mate"|
|00002e60| 7d 0d a5 20 6f 74 68 65 | 72 77 69 73 65 2c 20 74 |}.. othe|rwise, t|
|00002e70| 68 65 20 6f 74 68 65 72 | 20 73 6c 6f 74 20 77 69 |he other| slot wi|
|00002e80| 6c 6c 20 62 65 20 63 61 | 6c 6c 65 64 20 65 72 72 |ll be ca|lled err|
|00002e90| 6f 72 20 61 6e 64 20 77 | 69 6c 6c 20 63 6f 6e 74 |or and w|ill cont|
|00002ea0| 61 69 6e 20 61 6e 20 69 | 6e 74 65 67 65 72 20 28 |ain an i|nteger (|
|00002eb0| 65 72 72 6f 72 20 63 6f | 64 65 29 0d 7c 65 76 74 |error co|de).|evt|
|00002ec0| 2e 65 78 7c 3a 20 7b 6e | 61 6d 65 3a 20 3c 73 74 |.ex|: {n|ame: <st|
|00002ed0| 72 69 6e 67 3e 2c 20 65 | 72 72 6f 72 3a 20 3c 69 |ring>, e|rror: <i|
|00002ee0| 6e 74 65 67 65 72 3e 7d | 0d 45 78 3a 20 7b 3a 6e |nteger>}|.Ex: {:n|
|00002ef0| 61 6d 65 3a 20 22 48 69 | 20 48 6f 20 65 78 63 65 |ame: "Hi| Ho exce|
|00002f00| 70 74 69 6f 6e 22 2c 20 | 65 72 72 6f 72 3a 20 2d |ption", |error: -|
|00002f10| 34 38 36 36 36 7d 0d 48 | 65 72 65 20 61 72 65 20 |48666}.H|ere are |
|00002f20| 65 78 61 6d 70 6c 65 73 | 20 6f 66 20 65 78 63 65 |examples| of exce|
|00002f30| 70 74 69 6f 6e 20 66 72 | 61 6d 65 73 20 66 72 6f |ption fr|ames fro|
|00002f40| 6d 20 72 65 61 6c 20 6c | 69 66 65 3a 0d a5 20 45 |m real l|ife:.. E|
|00002f50| 78 61 6d 70 6c 65 20 41 | 2c 20 20 64 69 76 69 73 |xample A|, divis|
|00002f60| 69 6f 6e 20 62 79 20 7a | 65 72 6f 3a 0d 7b 6e 61 |ion by z|ero:.{na|
|00002f70| 6d 65 3a 20 7c 65 76 74 | 2e 65 78 2e 64 69 76 30 |me: |evt|.ex.div0|
|00002f80| 7c 2c 20 65 72 72 6f 72 | 3a 20 31 37 36 34 37 34 ||, error|: 176474|
|00002f90| 34 7d 0d 49 66 20 79 6f | 75 20 77 61 6e 74 20 74 |4}.If yo|u want t|
|00002fa0| 6f 20 63 61 74 63 68 20 | 64 69 76 69 73 69 6f 6e |o catch |division|
|00002fb0| 20 62 79 20 7a 65 72 6f | 20 65 72 72 6f 72 73 2c | by zero| errors,|
|00002fc0| 20 68 65 72 65 27 73 20 | 74 68 65 20 74 72 69 63 | here's |the tric|
|00002fd0| 6b 3a 0d 74 72 79 0d 09 | 35 2f 30 0d 6f 6e 65 78 |k:.try..|5/0.onex|
|00002fe0| 63 65 70 74 69 6f 6e 20 | 7c 65 76 74 2e 65 78 7c |ception ||evt.ex||
|00002ff0| 20 64 6f 0d 09 43 75 72 | 72 65 6e 74 45 78 63 65 | do..Cur|rentExce|
|00003000| 70 74 69 6f 6e 28 29 3b | 0d a5 20 45 78 61 6d 70 |ption();|.. Examp|
|00003010| 6c 65 20 42 2c 20 75 6e | 64 65 66 69 6e 65 64 20 |le B, un|defined |
|00003020| 76 61 72 69 61 62 6c 65 | 3a 0d 7b 6e 61 6d 65 3a |variable|:.{name:|
|00003030| 20 7c 65 76 74 2e 65 78 | 2e 66 72 2e 69 6e 74 65 | |evt.ex|.fr.inte|
|00003040| 72 70 3b 20 74 79 70 65 | 2e 72 65 66 2e 66 72 61 |rp; type|.ref.fra|
|00003050| 6d 65 7c 2c 20 64 61 74 | 61 3a 20 7b 65 72 72 6f |me|, dat|a: {erro|
|00003060| 72 3a 2d 34 38 38 30 37 | 2c 20 73 79 6d 62 6f 6c |r:-48807|, symbol|
|00003070| 3a 20 66 6f 6f 7d 7d 0d | 48 6f 77 20 74 6f 20 52 |: foo}}.|How to R|
|00003080| 61 69 73 65 20 47 65 6e | 74 6c 65 20 45 78 63 65 |aise Gen|tle Exce|
|00003090| 70 74 69 6f 6e 73 0d 59 | 6f 75 20 63 61 6e 20 74 |ptions.Y|ou can t|
|000030a0| 68 72 6f 77 20 61 6e 20 | 65 78 63 65 70 74 69 6f |hrow an |exceptio|
|000030b0| 6e 20 75 73 69 6e 67 20 | 74 68 65 20 67 6c 6f 62 |n using |the glob|
|000030c0| 61 6c 20 66 75 6e 63 74 | 69 6f 6e 2c 20 54 68 72 |al funct|ion, Thr|
|000030d0| 6f 77 28 3c 65 78 63 65 | 70 74 69 6f 6e 20 73 79 |ow(<exce|ption sy|
|000030e0| 6d 62 6f 6c 3e 2c 20 3c | 65 78 63 65 70 74 69 6f |mbol>, <|exceptio|
|000030f0| 6e 20 64 61 74 61 3e 29 | 2e 20 54 68 65 20 76 61 |n data>)|. The va|
|00003100| 6c 75 65 20 79 6f 75 20 | 70 61 73 73 20 66 6f 72 |lue you |pass for|
|00003110| 20 3c 65 78 63 65 70 74 | 69 6f 6e 20 64 61 74 61 | <except|ion data|
|00003120| 3e 20 69 73 20 70 75 74 | 20 69 6e 74 6f 20 74 68 |> is put| into th|
|00003130| 65 20 22 6f 74 68 65 72 | 22 20 73 6c 6f 74 20 6f |e "other|" slot o|
|00003140| 66 20 74 68 65 20 65 78 | 63 65 70 74 69 6f 6e 20 |f the ex|ception |
|00003150| 66 72 61 6d 65 2e 20 4d | 61 6b 65 20 73 75 72 65 |frame. M|ake sure|
|00003160| 20 69 74 20 69 73 20 74 | 68 65 20 63 6f 72 72 65 | it is t|he corre|
|00003170| 63 74 20 74 79 70 65 20 | 28 61 73 20 70 65 72 20 |ct type |(as per |
|00003180| 74 68 65 20 61 62 6f 76 | 65 20 72 75 6c 65 73 29 |the abov|e rules)|
|00003190| 20 6f 72 20 79 6f 75 72 | 20 20 63 61 6c 6c 20 74 | or your| call t|
|000031a0| 6f 20 54 68 72 6f 77 20 | 77 69 6c 6c 20 72 61 69 |o Throw |will rai|
|000031b0| 73 65 20 61 6e 6f 74 68 | 65 72 20 65 78 63 65 70 |se anoth|er excep|
|000031c0| 74 69 6f 6e 2e 0d 49 66 | 20 74 68 65 20 63 6f 64 |tion..If| the cod|
|000031d0| 65 20 62 6c 6f 63 6b 20 | 68 61 73 20 6d 6f 72 65 |e block |has more|
|000031e0| 20 74 68 61 6e 20 6f 6e | 65 20 74 72 79 20 73 74 | than on|e try st|
|000031f0| 61 74 65 6d 65 6e 74 20 | 69 6e 20 65 66 66 65 63 |atement |in effec|
|00003200| 74 20 61 74 20 6f 6e 65 | 20 74 69 6d 65 2c 20 79 |t at one| time, y|
|00003210| 6f 75 20 63 61 6e 20 70 | 61 73 73 20 63 6f 6e 74 |ou can p|ass cont|
|00003220| 72 6f 6c 20 74 6f 20 74 | 68 65 20 6e 65 78 74 20 |rol to t|he next |
|00003230| 65 6e 63 6c 6f 73 69 6e | 67 20 74 72 79 20 73 74 |enclosin|g try st|
|00003240| 61 74 65 6d 65 6e 74 20 | 75 73 69 6e 67 20 74 68 |atement |using th|
|00003250| 65 20 52 65 74 68 72 6f | 77 20 20 66 75 6e 63 74 |e Rethro|w funct|
|00003260| 69 6f 6e 2e 20 0d 48 65 | 72 65 20 61 72 65 20 65 |ion. .He|re are e|
|00003270| 78 61 6d 70 6c 65 73 20 | 6f 66 20 74 68 65 20 74 |xamples |of the t|
|00003280| 68 72 65 65 20 64 69 66 | 66 65 72 65 6e 74 20 77 |hree dif|ferent w|
|00003290| 61 79 73 20 74 6f 20 63 | 72 65 61 74 65 20 61 6e |ays to c|reate an|
|000032a0| 64 20 74 68 72 6f 77 20 | 65 78 63 65 70 74 69 6f |d throw |exceptio|
|000032b0| 6e 73 2e 20 4e 6f 74 65 | 20 74 68 61 74 20 79 6f |ns. Note| that yo|
|000032c0| 75 20 6e 65 65 64 20 74 | 6f 20 73 65 6e 64 20 61 |u need t|o send a|
|000032d0| 6e 20 65 78 63 65 70 74 | 69 6f 6e 20 73 79 6d 62 |n except|ion symb|
|000032e0| 6f 6c 20 28 27 29 3a 0d | 54 68 72 6f 77 28 27 7c |ol ('):.|Throw('||
|000032f0| 65 76 74 2e 65 78 2e 66 | 6f 6f 7c 2c 20 39 39 29 |evt.ex.f|oo|, 99)|
|00003300| 3b 0d 54 68 72 6f 77 28 | 27 7c 65 76 74 2e 65 78 |;.Throw(|'|evt.ex|
|00003310| 2e 6d 73 67 7c 2c 20 22 | 73 74 72 69 6e 67 22 29 |.msg|, "|string")|
|00003320| 3b 0d 54 68 72 6f 77 28 | 27 7c 65 76 74 2e 65 78 |;.Throw(|'|evt.ex|
|00003330| 3b 74 79 70 65 2e 72 65 | 66 2e 73 6f 6d 65 74 68 |;type.re|f.someth|
|00003340| 69 6e 67 7c 2c 20 5b 22 | 61 22 2c 20 22 62 22 2c |ing|, ["|a", "b",|
|00003350| 20 22 63 22 5d 29 0d 44 | 65 66 61 75 6c 74 20 45 | "c"]).D|efault E|
|00003360| 78 63 65 70 74 69 6f 6e | 20 48 61 6e 64 6c 69 6e |xception| Handlin|
|00003370| 67 0d 55 6e 66 6f 72 74 | 75 6e 61 74 65 6c 79 2c |g.Unfort|unately,|
|00003380| 20 74 68 65 72 65 20 69 | 73 20 63 75 72 72 65 6e | there i|s curren|
|00003390| 74 6c 79 20 6e 6f 20 67 | 65 6e 65 72 61 6c 20 77 |tly no g|eneral w|
|000033a0| 61 79 20 66 6f 72 20 79 | 6f 75 72 20 61 70 70 6c |ay for y|our appl|
|000033b0| 69 63 61 74 69 6f 6e 20 | 74 6f 20 73 70 65 63 69 |ication |to speci|
|000033c0| 66 79 20 61 20 64 65 66 | 61 75 6c 74 20 65 78 63 |fy a def|ault exc|
|000033d0| 65 70 74 69 6f 6e 20 68 | 61 6e 64 6c 65 72 2c 20 |eption h|andler, |
|000033e0| 66 6f 72 20 65 78 61 6d | 70 6c 65 2c 20 76 69 65 |for exam|ple, vie|
|000033f0| 77 45 78 63 65 70 74 69 | 6f 6e 53 63 72 69 70 74 |wExcepti|onScript|
|00003400| 2e 20 54 68 69 73 20 6d | 65 61 6e 73 20 79 6f 75 |. This m|eans you|
|00003410| 20 6e 65 65 64 20 74 6f | 20 75 73 65 20 74 72 79 | need to| use try|
|00003420| 20 73 74 61 74 65 6d 65 | 6e 74 73 20 77 68 65 72 | stateme|nts wher|
|00003430| 65 76 65 72 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |ever you| want to|
|00003440| 20 63 61 74 63 68 20 65 | 78 63 65 70 74 69 6f 6e | catch e|xception|
|00003450| 73 2e 0d 45 78 61 6d 70 | 6c 65 73 0d 48 65 72 65 |s..Examp|les.Here|
|00003460| 27 73 20 73 6f 6d 65 20 | 63 6f 64 65 20 20 74 6f |'s some |code to|
|00003470| 20 74 65 73 74 20 6f 75 | 74 20 74 68 65 20 65 78 | test ou|t the ex|
|00003480| 63 65 70 74 69 6f 6e 20 | 73 79 73 74 65 6d 2e 20 |ception |system. |
|00003490| 54 68 69 73 20 74 72 69 | 65 73 20 76 61 72 69 6f |This tri|es vario|
|000034a0| 75 73 20 63 61 73 65 73 | 20 61 6e 64 20 69 73 20 |us cases| and is |
|000034b0| 64 65 73 69 67 6e 65 64 | 20 74 6f 20 70 72 69 6e |designed| to prin|
|000034c0| 74 20 6e 6f 20 6f 75 74 | 70 75 74 2c 20 61 73 73 |t no out|put, ass|
|000034d0| 75 6d 69 6e 67 20 20 74 | 68 65 20 65 78 63 65 70 |uming t|he excep|
|000034e0| 74 69 6f 6e 20 73 79 73 | 74 65 6d 20 77 6f 72 6b |tion sys|tem work|
|000034f0| 73 20 61 73 20 61 64 76 | 65 72 74 69 73 65 64 2e |s as adv|ertised.|
|00003500| 20 48 6f 77 65 76 65 72 | 2c 20 20 74 68 65 20 4e | However|, the N|
|00003510| 54 4b 20 49 6e 73 70 65 | 63 74 6f 72 20 70 72 69 |TK Inspe|ctor pri|
|00003520| 6e 74 73 20 6f 75 74 20 | 65 76 65 72 79 20 65 78 |nts out |every ex|
|00003530| 63 65 70 74 69 6f 6e 20 | 74 68 61 74 20 69 73 20 |ception |that is |
|00003540| 74 68 72 6f 77 6e 2c 20 | 77 68 65 74 68 65 72 20 |thrown, |whether |
|00003550| 69 74 27 73 20 68 61 6e | 64 6c 65 64 20 6f 72 20 |it's han|dled or |
|00003560| 6e 6f 74 2e 20 45 78 70 | 65 63 74 20 74 6f 20 73 |not. Exp|ect to s|
|00003570| 65 65 20 6f 75 74 70 75 | 74 3b 20 68 6f 77 65 76 |ee outpu|t; howev|
|00003580| 65 72 2c 20 6e 6f 6e 65 | 20 6f 66 20 74 68 65 50 |er, none| of theP|
|00003590| 72 69 6e 74 28 22 2a 65 | 72 72 6f 72 3f 2a 29 20 |rint("*e|rror?*) |
|000035a0| 73 74 61 74 65 6d 65 6e | 74 73 20 73 68 6f 75 6c |statemen|ts shoul|
|000035b0| 64 20 65 78 65 63 75 74 | 65 2e 0d 2f 2f 73 69 6d |d execut|e..//sim|
|000035c0| 70 6c 65 20 63 61 73 65 | 73 20 26 20 61 20 6e 65 |ple case|s & a ne|
|000035d0| 73 74 65 64 20 62 6c 6f | 63 6b 0d 74 72 79 0d 09 |sted blo|ck.try..|
|000035e0| 62 65 67 69 6e 0d 09 0d | 09 09 74 72 79 0d 09 09 |begin...|..try...|
|000035f0| 09 54 68 72 6f 77 28 27 | 7c 65 76 74 2e 65 78 3b |.Throw('||evt.ex;|
|00003600| 74 79 70 65 2e 72 65 66 | 3b 66 6f 6f 7c 2c 22 64 |type.ref|;foo|,"d|
|00003610| 73 61 66 73 64 61 22 29 | 3b 0d 09 09 09 50 72 69 |safsda")|;....Pri|
|00003620| 6e 74 28 22 2a 65 72 72 | 6f 72 2a 31 22 29 3b 0d |nt("*err|or*1");.|
|00003630| 09 09 6f 6e 65 78 63 65 | 70 74 69 6f 6e 20 7c 66 |..onexce|ption |f|
|00003640| 6f 6f 7c 20 64 6f 0d 09 | 09 09 62 65 67 69 6e 0d |oo| do..|..begin.|
|00003650| 09 09 09 09 2f 2f 45 78 | 63 65 70 74 69 6f 6e 20 |....//Ex|ception |
|00003660| 68 61 6e 64 6c 65 64 20 | 71 75 69 65 74 6c 79 0d |handled |quietly.|
|00003670| 09 09 20 09 65 6e 64 3b | 0d 09 09 20 09 0d 09 09 |.. .end;|... ....|
|00003680| 74 72 79 0d 09 09 09 54 | 68 72 6f 77 28 27 7c 65 |try....T|hrow('|e|
|00003690| 76 74 2e 65 78 3b 74 79 | 70 65 2e 72 65 66 3b 66 |vt.ex;ty|pe.ref;f|
|000036a0| 6f 6f 7c 2c 22 64 73 61 | 66 73 64 61 22 29 3b 0d |oo|,"dsa|fsda");.|
|000036b0| 09 09 09 50 72 69 6e 74 | 28 22 2a 65 72 72 6f 72 |...Print|("*error|
|000036c0| 2a 32 22 29 3b 0d 09 09 | 6f 6e 65 78 63 65 70 74 |*2");...|onexcept|
|000036d0| 69 6f 6e 20 7c 74 79 70 | 65 2e 72 65 66 7c 20 64 |ion |typ|e.ref| d|
|000036e0| 6f 0d 09 09 09 62 65 67 | 69 6e 0d 09 09 09 09 2f |o....beg|in...../|
|000036f0| 2f 45 78 63 65 70 74 69 | 6f 6e 20 68 61 6e 64 6c |/Excepti|on handl|
|00003700| 65 64 20 71 75 69 65 74 | 6c 79 0d 09 09 20 09 65 |ed quiet|ly... .e|
|00003710| 6e 64 3b 0d 09 0d 09 20 | 20 2f 2f 6f 75 74 65 72 |nd;.... | //outer|
|00003720| 20 62 6c 6f 63 6b 20 73 | 68 6f 75 6c 64 20 63 61 | block s|hould ca|
|00003730| 74 63 68 20 74 68 69 73 | 20 6f 6e 65 0d 09 09 54 |tch this| one...T|
|00003740| 68 72 6f 77 28 27 7c 65 | 76 74 2e 65 78 2e 66 6f |hrow('|e|vt.ex.fo|
|00003750| 6f 62 61 72 7c 2c 34 32 | 29 3b 0d 09 09 09 20 09 |obar|,42|);.... .|
|00003760| 0d 09 20 20 50 72 69 6e | 74 28 22 2a 65 72 72 6f |.. Prin|t("*erro|
|00003770| 72 2a 33 22 29 3b 0d 09 | 65 6e 64 0d 6f 6e 65 78 |r*3");..|end.onex|
|00003780| 63 65 70 74 69 6f 6e 20 | 7c 65 76 74 2e 65 78 7c |ception ||evt.ex||
|00003790| 20 64 6f 0d 09 69 66 20 | 43 75 72 72 65 6e 74 45 | do..if |CurrentE|
|000037a0| 78 63 65 70 74 69 6f 6e | 28 29 2e 65 72 72 6f 72 |xception|().error|
|000037b0| 20 3c 3e 20 34 32 20 74 | 68 65 6e 0d 09 09 62 65 | <> 42 t|hen...be|
|000037c0| 67 69 6e 0d 09 09 09 50 | 72 69 6e 74 28 22 2a 65 |gin....P|rint("*e|
|000037d0| 72 72 6f 72 2a 34 22 29 | 3b 0d 09 09 09 50 72 69 |rror*4")|;....Pri|
|000037e0| 6e 74 28 43 75 72 72 65 | 6e 74 45 78 63 65 70 74 |nt(Curre|ntExcept|
|000037f0| 69 6f 6e 28 29 29 0d 09 | 09 65 6e 64 3b 0d 2f 2f |ion())..|.end;.//|
|00003800| 74 72 79 20 6f 75 74 20 | 72 65 74 68 72 6f 77 28 |try out |rethrow(|
|00003810| 29 0d 74 72 79 0d 09 62 | 65 67 69 6e 0d 09 09 0d |).try..b|egin....|
|00003820| 09 09 74 72 79 0d 09 09 | 09 54 68 72 6f 77 28 27 |..try...|.Throw('|
|00003830| 7c 65 76 74 2e 65 78 7c | 2c 34 32 29 3b 0d 09 09 ||evt.ex||,42);...|
|00003840| 09 50 72 69 6e 74 28 22 | 2a 65 72 72 6f 72 2a 35 |.Print("|*error*5|
|00003850| 22 29 3b 0d 09 09 6f 6e | 65 78 63 65 70 74 69 6f |");...on|exceptio|
|00003860| 6e 20 7c 65 76 74 2e 65 | 78 7c 20 64 6f 0d 09 09 |n |evt.e|x| do...|
|00003870| 09 62 65 67 69 6e 0d 09 | 20 20 20 20 20 2f 2f 6f |.begin..| //o|
|00003880| 75 74 65 72 20 62 6c 6f | 63 6b 20 73 68 6f 75 6c |uter blo|ck shoul|
|00003890| 64 20 63 61 74 63 68 20 | 74 68 69 73 20 6f 6e 65 |d catch |this one|
|000038a0| 0d 09 09 09 09 52 65 74 | 68 72 6f 77 28 29 3b 0d |.....Ret|hrow();.|
|000038b0| 09 09 20 09 65 6e 64 3b | 0d 09 0d 09 50 72 69 6e |.. .end;|....Prin|
|000038c0| 74 28 22 2a 65 72 72 6f | 72 2a 36 22 29 3b 0d 09 |t("*erro|r*6");..|
|000038d0| 09 20 09 0d 09 65 6e 64 | 0d 6f 6e 65 78 63 65 70 |. ...end|.onexcep|
|000038e0| 74 69 6f 6e 20 7c 65 76 | 74 2e 65 78 7c 20 64 6f |tion |ev|t.ex| do|
|000038f0| 0d 09 69 66 20 43 75 72 | 72 65 6e 74 45 78 63 65 |..if Cur|rentExce|
|00003900| 70 74 69 6f 6e 28 29 2e | 65 72 72 6f 72 20 3c 3e |ption().|error <>|
|00003910| 20 34 32 20 74 68 65 6e | 0d 09 09 62 65 67 69 6e | 42 then|...begin|
|00003920| 0d 09 09 09 50 72 69 6e | 74 28 22 2a 65 72 72 6f |....Prin|t("*erro|
|00003930| 72 2a 37 22 29 3b 0d 09 | 09 09 50 72 69 6e 74 28 |r*7");..|..Print(|
|00003940| 43 75 72 72 65 6e 74 45 | 78 63 65 70 74 69 6f 6e |CurrentE|xception|
|00003950| 28 29 29 0d 09 09 65 6e | 64 3b 0d 2f 2f 74 72 79 |())...en|d;.//try|
|00003960| 20 69 74 20 6f 75 74 20 | 77 69 74 68 20 66 6e 20 | it out |with fn |
|00003970| 63 61 6c 6c 73 0d 74 72 | 79 0d 09 62 65 67 69 6e |calls.tr|y..begin|
|00003980| 0d 09 09 0d 09 09 63 61 | 6c 6c 20 66 75 6e 63 28 |......ca|ll func(|
|00003990| 29 0d 09 09 09 62 65 67 | 69 6e 0d 09 09 09 09 74 |)....beg|in.....t|
|000039a0| 72 79 0d 09 09 09 09 09 | 63 61 6c 6c 20 66 75 6e |ry......|call fun|
|000039b0| 63 28 65 73 79 6d 29 20 | 54 68 72 6f 77 28 65 73 |c(esym) |Throw(es|
|000039c0| 79 6d 2c 34 32 29 20 77 | 69 74 68 20 28 27 7c 65 |ym,42) w|ith ('|e|
|000039d0| 76 74 2e 65 78 7c 29 3b | 0d 09 09 09 09 09 50 72 |vt.ex|);|......Pr|
|000039e0| 69 6e 74 28 22 2a 65 72 | 72 6f 72 2a 38 22 29 3b |int("*er|ror*8");|
|000039f0| 0d 09 09 09 09 6f 6e 65 | 78 63 65 70 74 69 6f 6e |.....one|xception|
|00003a00| 20 7c 74 79 70 65 2e 72 | 65 66 7c 20 64 6f 0d 09 | |type.r|ef| do..|
|00003a10| 09 09 09 09 62 65 67 69 | 6e 0d 09 09 09 20 20 20 |....begi|n.... |
|00003a20| 20 20 2f 2f 6f 75 74 65 | 72 20 62 6c 6f 63 6b 20 | //oute|r block |
|00003a30| 73 68 6f 75 6c 64 20 63 | 61 74 63 68 20 74 68 69 |should c|atch thi|
|00003a40| 73 20 6f 6e 65 0d 09 09 | 09 09 09 09 52 65 74 68 |s one...|....Reth|
|00003a50| 72 6f 77 28 29 3b 0d 09 | 09 09 09 20 09 65 6e 64 |row();..|... .end|
|00003a60| 3b 0d 09 09 09 65 6e 64 | 0d 09 09 77 69 74 68 20 |;....end|...with |
|00003a70| 28 29 3b 0d 09 09 0d 09 | 09 50 72 69 6e 74 28 22 |();.....|.Print("|
|00003a80| 2a 65 72 72 6f 72 2a 39 | 22 29 3b 0d 09 09 20 09 |*error*9|");... .|
|00003a90| 0d 09 65 6e 64 0d 6f 6e | 65 78 63 65 70 74 69 6f |..end.on|exceptio|
|00003aa0| 6e 20 7c 65 76 74 2e 65 | 78 7c 20 64 6f 0d 09 69 |n |evt.e|x| do..i|
|00003ab0| 66 20 43 75 72 72 65 6e | 74 45 78 63 65 70 74 69 |f Curren|tExcepti|
|00003ac0| 6f 6e 28 29 2e 65 72 72 | 6f 72 20 3c 3e 20 34 32 |on().err|or <> 42|
|00003ad0| 20 74 68 65 6e 0d 09 09 | 62 65 67 69 6e 0d 09 09 | then...|begin...|
|00003ae0| 09 50 72 69 6e 74 28 22 | 2a 65 72 72 6f 72 2a 31 |.Print("|*error*1|
|00003af0| 30 22 29 3b 0d 09 09 09 | 50 72 69 6e 74 28 43 75 |0");....|Print(Cu|
|00003b00| 72 72 65 6e 74 45 78 63 | 65 70 74 69 6f 6e 28 29 |rrentExc|eption()|
|00003b10| 29 0d 09 09 65 6e 64 3b | 0d 50 72 69 6e 74 28 22 |)...end;|.Print("|
|00003b20| 6e 6f 20 6e 65 77 73 2c | 20 69 73 20 67 6f 6f 64 |no news,| is good|
|00003b30| 20 6e 65 77 73 22 29 3b | 0d 5f 5f 5f 5f 5f 5f 5f | news");|._______|
|00003b40| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00003b50| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00003b60| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00003b70| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00003b80| 5f 5f 5f 5f 5f 5f 09 0d | 4e 65 77 74 6f 6e 53 63 |______..|NewtonSc|
|00003b90| 72 69 70 74 20 51 26 41 | 73 0d 09 5f 5f 5f 5f 5f |ript Q&A|s.._____|
|00003ba0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00003bb0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00003bc0| 5f 5f 5f 5f 5f 5f 0d 47 | 61 72 62 61 67 65 20 43 |______.G|arbage C|
|00003bd0| 6f 6c 6c 65 63 74 69 6f | 6e 20 28 31 30 2f 31 35 |ollectio|n (10/15|
|00003be0| 2f 39 33 29 20 28 4f 62 | 73 6f 6c 65 74 65 64 20 |/93) (Ob|soleted |
|00003bf0| 62 79 20 4e 53 20 47 75 | 69 64 65 20 31 2e 30 20 |by NS Gu|ide 1.0 |
|00003c00| 46 69 6e 61 6c 20 44 6f | 63 75 6d 65 6e 74 61 74 |Final Do|cumentat|
|00003c10| 69 6f 6e 29 0d 49 6e 20 | 4e 65 77 74 6f 6e 53 63 |ion).In |NewtonSc|
|00003c20| 72 69 70 74 2c 20 74 68 | 65 20 72 75 6e 2d 74 69 |ript, th|e run-ti|
|00003c30| 6d 65 20 6d 6f 64 75 6c | 65 2c 20 6e 6f 74 20 74 |me modul|e, not t|
|00003c40| 68 65 20 70 72 6f 67 72 | 61 6d 6d 65 72 2c 20 69 |he progr|ammer, i|
|00003c50| 73 20 72 65 73 70 6f 6e | 73 69 62 6c 65 20 66 6f |s respon|sible fo|
|00003c60| 72 20 61 6c 6c 6f 63 61 | 74 69 6e 67 20 73 74 6f |r alloca|ting sto|
|00003c70| 72 61 67 65 20 66 6f 72 | 20 6f 62 6a 65 63 74 73 |rage for| objects|
|00003c80| 20 61 6e 64 20 66 6f 72 | 20 72 65 63 6c 61 69 6d | and for| reclaim|
|00003c90| 69 6e 67 20 74 68 65 20 | 73 74 6f 72 61 67 65 20 |ing the |storage |
|00003ca0| 6f 66 20 6f 62 6a 65 63 | 74 73 20 74 68 61 74 20 |of objec|ts that |
|00003cb0| 61 72 65 20 6e 6f 20 6c | 6f 6e 67 65 72 20 75 73 |are no l|onger us|
|00003cc0| 65 64 2e 20 47 61 72 62 | 61 67 65 20 63 6f 6c 6c |ed. Garb|age coll|
|00003cd0| 65 63 74 69 6f 6e 20 69 | 73 20 63 61 72 72 69 65 |ection i|s carrie|
|00003ce0| 64 20 6f 75 74 20 62 79 | 20 74 68 65 20 62 61 73 |d out by| the bas|
|00003cf0| 69 63 20 6f 62 6a 65 63 | 74 20 73 79 73 74 65 6d |ic objec|t system|
|00003d00| 2c 20 73 6f 20 69 74 d5 | 73 20 6e 6f 74 20 74 65 |, so it.|s not te|
|00003d10| 63 68 6e 69 63 61 6c 6c | 79 20 4e 65 77 74 6f 6e |chnicall|y Newton|
|00003d20| 53 63 72 69 70 74 20 74 | 68 61 74 20 64 6f 65 73 |Script t|hat does|
|00003d30| 20 69 74 2e 20 20 54 68 | 65 20 73 74 6f 72 61 67 | it. Th|e storag|
|00003d40| 65 20 74 61 6b 65 6e 20 | 75 70 20 62 79 20 61 6e |e taken |up by an|
|00003d50| 20 6f 62 6a 65 63 74 20 | 77 69 6c 6c 20 62 65 20 | object |will be |
|00003d60| 66 72 65 65 64 20 73 6f | 6d 65 74 69 6d 65 20 61 |freed so|metime a|
|00003d70| 66 74 65 72 20 74 68 65 | 20 6c 61 73 74 20 72 65 |fter the| last re|
|00003d80| 66 65 72 65 6e 63 65 20 | 74 6f 20 74 68 61 74 20 |ference |to that |
|00003d90| 6f 62 6a 65 63 74 20 67 | 6f 65 73 20 61 77 61 79 |object g|oes away|
|00003da0| 2e 0d 4f 6e 65 20 6f 66 | 20 74 68 65 20 6d 61 6e |..One of| the man|
|00003db0| 79 20 62 65 6e 65 66 69 | 74 73 20 6f 66 20 67 61 |y benefi|ts of ga|
|00003dc0| 72 62 61 67 65 20 63 6f | 6c 6c 65 63 74 69 6f 6e |rbage co|llection|
|00003dd0| 20 69 73 20 74 68 61 74 | 20 74 68 65 20 70 72 6f | is that| the pro|
|00003de0| 67 72 61 6d 6d 65 72 20 | 68 61 73 20 74 6f 20 74 |grammer |has to t|
|00003df0| 68 69 6e 6b 20 61 62 6f | 75 74 20 66 72 65 65 69 |hink abo|ut freei|
|00003e00| 6e 67 20 6f 62 6a 65 63 | 74 73 20 6f 6e 6c 79 20 |ng objec|ts only |
|00003e10| 20 69 6e 20 61 20 73 6d | 61 6c 6c 20 6e 75 6d 62 | in a sm|all numb|
|00003e20| 65 72 20 6f 66 20 69 6d | 70 6f 72 74 61 6e 74 20 |er of im|portant |
|00003e30| 70 6c 61 63 65 73 2c 20 | 61 73 20 6f 70 70 6f 73 |places, |as oppos|
|00003e40| 65 64 20 74 6f 20 64 65 | 61 6c 69 6e 67 20 77 69 |ed to de|aling wi|
|00003e50| 74 68 20 74 68 65 20 63 | 6f 6e 73 74 61 6e 74 20 |th the c|onstant |
|00003e60| 62 61 63 6b 67 72 6f 75 | 6e 64 20 77 6f 72 72 79 |backgrou|nd worry|
|00003e70| 20 74 68 61 74 20 6f 62 | 6a 65 63 74 73 20 6d 75 | that ob|jects mu|
|00003e80| 73 74 20 62 65 20 66 72 | 65 65 64 2e 20 57 74 68 |st be fr|eed. Wth|
|00003e90| 20 61 75 74 6f 6d 61 74 | 69 63 20 67 61 72 62 61 | automat|ic garba|
|00003ea0| 67 65 20 63 6f 6c 6c 65 | 63 74 69 6f 6e 20 79 6f |ge colle|ction yo|
|00003eb0| 75 20 6f 6e 6c 79 20 6e | 65 65 64 20 74 6f 20 63 |u only n|eed to c|
|00003ec0| 6f 6e 73 69 64 65 72 20 | 64 69 73 70 6f 73 69 6e |onsider |disposin|
|00003ed0| 67 20 6f 62 6a 65 63 74 | 73 20 69 6e 20 72 61 72 |g object|s in rar|
|00003ee0| 65 20 63 61 73 65 73 2e | 0d 4f 6e 65 20 70 6c 61 |e cases.|.One pla|
|00003ef0| 63 65 20 77 68 65 72 65 | 20 79 6f 75 20 73 68 6f |ce where| you sho|
|00003f00| 75 6c 64 20 74 68 69 6e | 6b 20 61 62 6f 75 74 20 |uld thin|k about |
|00003f10| 69 74 20 69 73 20 77 68 | 65 6e 20 79 6f 75 20 63 |it is wh|en you c|
|00003f20| 6c 6f 73 65 20 61 6e 20 | 61 70 70 6c 69 63 61 74 |lose an |applicat|
|00003f30| 69 6f 6e 3b 20 68 65 72 | 65 20 79 6f 75 20 77 61 |ion; her|e you wa|
|00003f40| 6e 74 20 74 6f 20 66 72 | 65 65 20 61 73 20 6d 75 |nt to fr|ee as mu|
|00003f50| 63 68 20 73 74 6f 72 61 | 67 65 20 61 73 20 70 6f |ch stora|ge as po|
|00003f60| 73 73 69 62 6c 65 2e 20 | 59 6f 75 20 64 6f 20 74 |ssible. |You do t|
|00003f70| 68 69 73 20 62 79 20 65 | 69 74 68 65 72 20 72 65 |his by e|ither re|
|00003f80| 6d 6f 76 69 6e 67 20 73 | 6c 6f 74 73 20 20 6f 72 |moving s|lots or|
|00003f90| 20 62 79 20 73 65 74 74 | 69 6e 67 20 73 6c 6f 74 | by sett|ing slot|
|00003fa0| 73 20 74 6f 20 6e 69 6c | 20 69 6e 20 74 68 65 20 |s to nil| in the |
|00003fb0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 27 73 20 63 6f |applicat|ion's co|
|00003fc0| 6e 74 65 78 74 20 66 72 | 61 6d 65 2e 20 20 53 65 |ntext fr|ame. Se|
|00003fd0| 74 74 69 6e 67 20 74 68 | 65 20 76 61 6c 75 65 20 |tting th|e value |
|00003fe0| 6f 66 20 61 6c 6c 20 73 | 6c 6f 74 73 20 61 6e 64 |of all s|lots and|
|00003ff0| 20 76 61 72 69 61 62 6c | 65 73 20 72 65 66 65 72 | variabl|es refer|
|00004000| 72 69 6e 67 20 74 6f 20 | 61 20 70 61 72 74 69 63 |ring to |a partic|
|00004010| 75 6c 61 72 20 6f 62 6a | 65 63 74 20 74 6f 20 6e |ular obj|ect to n|
|00004020| 69 6c 20 61 6c 6c 6f 77 | 73 20 74 68 65 20 47 61 |il allow|s the Ga|
|00004030| 72 62 61 67 65 20 43 6f | 6c 6c 65 63 74 6f 72 20 |rbage Co|llector |
|00004040| 74 6f 20 64 65 73 74 72 | 6f 79 20 74 68 65 20 6f |to destr|oy the o|
|00004050| 62 6a 65 63 74 2e 0d 57 | 69 74 68 69 6e 20 74 68 |bject..W|ithin th|
|00004060| 65 20 4e 65 77 74 6f 6e | 20 6f 70 65 72 61 74 69 |e Newton| operati|
|00004070| 6e 67 20 73 79 73 74 65 | 6d 2c 20 61 75 74 6f 6d |ng syste|m, autom|
|00004080| 61 74 69 63 20 67 61 72 | 62 61 67 65 20 63 6f 6c |atic gar|bage col|
|00004090| 6c 65 63 74 69 6f 6e 20 | 69 73 20 74 72 69 67 67 |lection |is trigg|
|000040a0| 65 72 65 64 20 65 76 65 | 72 79 20 74 69 6d 65 20 |ered eve|ry time |
|000040b0| 74 68 65 20 73 79 73 74 | 65 6d 20 72 75 6e 73 20 |the syst|em runs |
|000040c0| 6f 75 74 20 6f 66 20 6d | 65 6d 6f 72 79 2e 20 54 |out of m|emory. T|
|000040d0| 68 65 72 65 27 73 20 6e | 6f 74 20 72 65 61 6c 6c |here's n|ot reall|
|000040e0| 79 20 61 6e 79 20 72 65 | 61 73 6f 6e 20 74 6f 20 |y any re|ason to |
|000040f0| 69 6e 76 6f 6b 65 20 67 | 61 72 62 61 67 65 20 63 |invoke g|arbage c|
|00004100| 6f 6c 6c 65 63 74 69 6f | 6e 20 6d 61 6e 75 61 6c |ollectio|n manual|
|00004110| 6c 79 2e 20 48 6f 77 65 | 76 65 72 2c 20 69 66 20 |ly. Howe|ver, if |
|00004120| 79 6f 75 20 6d 75 73 74 | 20 64 6f 20 73 6f 2c 20 |you must| do so, |
|00004130| 79 6f 75 20 63 61 6e 20 | 63 61 6c 6c 20 74 68 65 |you can |call the|
|00004140| 20 67 6c 6f 62 61 6c 20 | 4e 65 77 74 6f 6e 53 63 | global |NewtonSc|
|00004150| 72 69 70 74 20 66 75 6e | 63 74 69 6f 6e 20 47 43 |ript fun|ction GC|
|00004160| 2e 20 43 6f 6e 73 75 6c | 74 20 74 68 65 20 4e 65 |. Consul|t the Ne|
|00004170| 77 74 6f 6e 20 50 72 6f | 67 72 61 6d 6d 65 72 d5 |wton Pro|grammer.|
|00004180| 73 20 47 75 69 64 65 20 | 74 6f 20 66 69 6e 64 20 |s Guide |to find |
|00004190| 6f 75 74 20 6d 6f 72 65 | 20 61 62 6f 75 74 20 74 |out more| about t|
|000041a0| 68 65 20 47 43 20 66 75 | 6e 63 74 69 6f 6e 2e 0d |he GC fu|nction..|
|000041b0| 09 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |._______|________|
|000041c0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000041d0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 0d 4f 72 64 |________|____.Ord|
|000041e0| 65 72 20 6f 66 20 53 6c | 6f 74 73 20 69 6e 20 46 |er of Sl|ots in F|
|000041f0| 72 61 6d 65 73 20 28 39 | 2f 31 35 2f 39 33 29 20 |rames (9|/15/93) |
|00004200| 0d 51 3a 20 09 54 68 65 | 20 64 65 73 63 72 69 70 |.Q: .The| descrip|
|00004210| 74 69 6f 6e 20 6f 66 20 | 74 68 65 20 66 6f 72 65 |tion of |the fore|
|00004220| 61 63 68 20 66 75 6e 63 | 74 69 6f 6e 20 69 6e 20 |ach func|tion in |
|00004230| 74 68 65 20 6d 61 6e 75 | 61 6c 20 6d 69 67 68 74 |the manu|al might|
|00004240| 20 62 65 20 74 61 6b 65 | 6e 20 61 73 20 61 20 68 | be take|n as a h|
|00004250| 69 6e 74 20 74 68 61 74 | 20 73 6c 6f 74 73 20 69 |int that| slots i|
|00004260| 6e 20 66 72 61 6d 65 73 | 20 61 72 65 20 6f 72 64 |n frames| are ord|
|00004270| 65 72 65 64 2e 20 20 44 | 6f 65 73 20 73 6c 6f 74 |ered. D|oes slot|
|00004280| 20 6f 72 20 61 72 72 61 | 79 20 6f 72 64 65 72 20 | or arra|y order |
|00004290| 69 6d 70 6c 79 20 61 6e | 79 74 68 69 6e 67 20 61 |imply an|ything a|
|000042a0| 62 6f 75 74 20 6c 61 79 | 6f 75 74 20 6f 66 20 64 |bout lay|out of d|
|000042b0| 61 74 61 20 69 6e 20 6d | 65 6d 6f 72 79 20 28 61 |ata in m|emory (a|
|000042c0| 73 20 77 69 74 68 20 43 | 20 73 74 72 75 63 74 73 |s with C| structs|
|000042d0| 3f 29 0d 41 3a 20 09 53 | 6c 6f 74 73 20 61 72 65 |?).A: .S|lots are|
|000042e0| 20 6e 6f 74 20 6f 72 64 | 65 72 65 64 2c 20 6e 6f | not ord|ered, no|
|000042f0| 72 20 68 61 76 65 20 77 | 65 20 73 65 65 6e 20 61 |r have w|e seen a|
|00004300| 6e 79 20 70 65 72 66 6f | 72 6d 61 6e 63 65 20 67 |ny perfo|rmance g|
|00004310| 61 69 6e 73 20 66 72 6f | 6d 20 6f 72 64 65 72 69 |ains fro|m orderi|
|00004320| 6e 67 20 73 6c 6f 74 73 | 20 66 6f 72 20 70 61 72 |ng slots| for par|
|00004330| 74 69 63 75 6c 61 72 20 | 73 65 71 75 65 6e 63 65 |ticular |sequence|
|00004340| 73 20 6f 72 20 73 65 61 | 72 63 68 20 63 72 69 74 |s or sea|rch crit|
|00004350| 65 72 69 61 2e 20 44 6f | 6e d5 74 20 63 6f 75 6e |eria. Do|n.t coun|
|00004360| 74 20 6f 6e 20 74 68 65 | 69 72 20 62 65 69 6e 67 |t on the|ir being|
|00004370| 20 69 6e 20 61 6e 79 20 | 70 61 72 74 69 63 75 6c | in any |particul|
|00004380| 61 72 20 6f 72 64 65 72 | 2c 20 6e 6f 72 20 6f 6e |ar order|, nor on|
|00004390| 20 64 61 74 61 20 73 74 | 72 75 63 74 75 72 65 73 | data st|ructures|
|000043a0| 20 69 6e 20 6d 65 6d 6f | 72 79 20 62 65 69 6e 67 | in memo|ry being|
|000043b0| 20 6f 72 64 65 72 65 64 | 20 77 69 74 68 20 61 6e | ordered| with an|
|000043c0| 79 20 72 65 67 61 72 64 | 20 74 6f 20 74 68 65 20 |y regard| to the |
|000043d0| 70 6c 61 63 65 6d 65 6e | 74 20 6f 66 20 73 6c 6f |placemen|t of slo|
|000043e0| 74 73 20 28 61 73 20 69 | 6e 20 74 68 65 20 41 4e |ts (as i|n the AN|
|000043f0| 53 49 20 43 6f 6d 6d 6f | 6e 20 4c 49 53 50 20 6f |SI Commo|n LISP o|
|00004400| 62 6a 65 63 74 20 65 78 | 74 65 6e 73 69 6f 6e 20 |bject ex|tension |
|00004410| 43 4c 4f 53 29 2e 20 0d | 51 3a 09 57 68 65 72 65 |CLOS). .|Q:.Where|
|00004420| 20 69 73 20 61 20 6e 65 | 77 6c 79 2d 64 65 66 69 | is a ne|wly-defi|
|00004430| 6e 65 64 20 73 6c 6f 74 | 20 70 6c 61 63 65 64 20 |ned slot| placed |
|00004440| 69 6e 20 61 20 66 72 61 | 6d 65 3f 20 61 74 20 74 |in a fra|me? at t|
|00004450| 68 65 20 65 6e 64 3f 0d | 41 3a 09 42 65 63 61 75 |he end?.|A:.Becau|
|00004460| 73 65 20 73 6c 6f 74 73 | 20 61 72 65 20 75 6e 6f |se slots| are uno|
|00004470| 72 64 65 72 65 64 2c 20 | 74 68 65 20 6c 6f 63 61 |rdered, |the loca|
|00004480| 74 69 6f 6e 20 6f 66 20 | 61 20 6e 65 77 20 73 6c |tion of |a new sl|
|00004490| 6f 74 20 63 61 6e 6e 6f | 74 20 62 65 20 70 72 65 |ot canno|t be pre|
|000044a0| 64 65 74 65 72 6d 69 6e | 65 64 2e 0d 09 5f 5f 5f |determin|ed...___|
|000044b0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000044c0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000044d0| 5f 5f 5f 5f 5f 5f 5f 5f | 0d 53 74 72 75 63 74 75 |________|.Structu|
|000044e0| 72 65 64 20 4c 69 74 65 | 72 61 6c 73 20 28 39 2f |red Lite|rals (9/|
|000044f0| 31 35 2f 39 33 29 20 0d | 51 3a 20 09 49 73 20 69 |15/93) .|Q: .Is i|
|00004500| 74 20 72 65 61 6c 6c 79 | 20 64 61 6e 67 65 72 6f |t really| dangero|
|00004510| 75 73 20 74 6f 20 61 73 | 73 69 67 6e 20 61 20 73 |us to as|sign a s|
|00004520| 74 72 69 6e 67 20 6c 69 | 74 65 72 61 6c 20 74 6f |tring li|teral to|
|00004530| 20 61 20 76 61 72 69 61 | 62 6c 65 2c 20 61 73 20 | a varia|ble, as |
|00004540| 69 6e 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |in the f|ollowing|
|00004550| 20 65 78 61 6d 70 6c 65 | 3f 0d 09 73 20 3a 3d 20 | example|?..s := |
|00004560| 22 61 62 63 22 3b 0d 41 | 3a 20 09 54 68 61 74 20 |"abc";.A|: .That |
|00004570| 64 65 70 65 6e 64 73 20 | 6f 6e 20 77 68 61 74 20 |depends |on what |
|00004580| 79 6f 75 27 72 65 20 67 | 6f 69 6e 67 20 74 6f 20 |you're g|oing to |
|00004590| 64 6f 20 77 69 74 68 20 | 73 2e 20 49 66 20 79 6f |do with |s. If yo|
|000045a0| 75 27 72 65 0d 09 67 6f | 69 6e 67 20 74 6f 20 6d |u're..go|ing to m|
|000045b0| 6f 64 69 66 79 20 69 74 | 2c 20 74 68 65 6e 20 79 |odify it|, then y|
|000045c0| 65 73 2c 20 69 74 27 73 | 20 64 61 6e 67 65 72 6f |es, it's| dangero|
|000045d0| 75 73 2e 20 49 6e 20 74 | 68 61 74 20 63 61 73 65 |us. In t|hat case|
|000045e0| 2c 20 79 6f 75 0d 09 73 | 68 6f 75 6c 64 20 75 73 |, you..s|hould us|
|000045f0| 65 20 0d 09 73 20 3a 3d | 20 43 6c 6f 6e 65 28 22 |e ..s :=| Clone("|
|00004600| 61 62 63 22 29 3b 0d 09 | 49 6e 20 67 65 6e 65 72 |abc");..|In gener|
|00004610| 61 6c 20 79 6f 75 20 73 | 68 6f 75 6c 64 20 74 72 |al you s|hould tr|
|00004620| 65 61 74 20 73 74 72 69 | 6e 67 20 6c 69 74 65 72 |eat stri|ng liter|
|00004630| 61 6c 73 20 69 6e 20 4e | 65 77 74 6f 6e 53 63 72 |als in N|ewtonScr|
|00004640| 69 70 74 0d 09 61 73 20 | 72 65 61 64 2d 6f 6e 6c |ipt..as |read-onl|
|00004650| 79 20 28 6a 75 73 74 20 | 61 73 20 79 6f 75 20 73 |y (just |as you s|
|00004660| 68 6f 75 6c 64 20 69 6e | 20 41 4e 53 49 20 43 29 |hould in| ANSI C)|
|00004670| 2e 20 53 74 72 69 6e 67 | 20 6c 69 74 65 72 61 6c |. String| literal|
|00004680| 73 20 6d 69 67 68 74 0d | 09 72 65 73 69 64 65 20 |s might.|.reside |
|00004690| 69 6e 20 72 65 61 64 2d | 6f 6e 6c 79 20 6d 65 6d |in read-|only mem|
|000046a0| 6f 72 79 20 6f 72 20 73 | 68 61 72 65 20 73 74 6f |ory or s|hare sto|
|000046b0| 72 61 67 65 20 77 69 74 | 68 20 6f 74 68 65 72 20 |rage wit|h other |
|000046c0| 6c 69 74 65 72 61 6c 73 | 2e 0d 09 54 68 65 20 73 |literals|...The s|
|000046d0| 61 6d 65 20 77 61 72 6e | 69 6e 67 20 61 70 70 6c |ame warn|ing appl|
|000046e0| 69 65 73 20 74 6f 20 71 | 75 6f 74 65 64 20 61 72 |ies to q|uoted ar|
|000046f0| 72 61 79 20 61 6e 64 20 | 66 72 61 6d 65 20 6c 69 |ray and |frame li|
|00004700| 74 65 72 61 6c 73 2c 20 | 61 73 20 69 6e 20 74 68 |terals, |as in th|
|00004710| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 65 78 61 6d |e follow|ing exam|
|00004720| 70 6c 65 3a 0d 09 20 27 | 5b 31 2c 32 2c 33 5d 20 |ple:.. '|[1,2,3] |
|00004730| 6f 72 20 27 7b 6f 6e 65 | 3a 20 31 2c 20 74 77 6f |or '{one|: 1, two|
|00004740| 3a 20 32 2c 20 74 68 72 | 65 65 3a 20 33 7d 0d 09 |: 2, thr|ee: 3}..|
|00004750| 48 65 72 65 20 61 72 65 | 20 73 6f 6d 65 20 72 75 |Here are| some ru|
|00004760| 6c 65 73 20 72 65 67 61 | 72 64 69 6e 67 20 73 74 |les rega|rding st|
|00004770| 72 69 6e 67 20 6c 69 74 | 65 72 61 6c 73 20 61 6e |ring lit|erals an|
|00004780| 64 20 71 75 6f 74 65 64 | 20 61 72 72 61 79 2f 66 |d quoted| array/f|
|00004790| 72 61 6d 65 20 6c 69 74 | 65 72 61 6c 73 3a 0d 09 |rame lit|erals:..|
|000047a0| 2d 20 54 72 65 61 74 20 | 74 68 65 6d 20 61 73 20 |- Treat |them as |
|000047b0| 72 65 61 64 20 6f 6e 6c | 79 2e 20 55 73 65 20 63 |read onl|y. Use c|
|000047c0| 6c 6f 6e 65 73 20 77 68 | 65 6e 20 6e 65 63 65 73 |lones wh|en neces|
|000047d0| 73 61 72 79 2e 0d 20 0d | 09 2d 20 52 65 61 6c 69 |sary.. .|.- Reali|
|000047e0| 7a 65 20 74 68 61 74 20 | 74 68 65 79 20 61 6c 77 |ze that |they alw|
|000047f0| 61 79 73 20 72 65 70 72 | 65 73 65 6e 74 20 74 68 |ays repr|esent th|
|00004800| 65 20 73 61 6d 65 20 6f | 62 6a 65 63 74 2e 20 20 |e same o|bject. |
|00004810| 20 49 6e 20 74 68 65 20 | 65 78 61 6d 70 6c 65 20 | In the |example |
|00004820| 62 65 6c 6f 77 2c 0d 09 | 66 75 6e 63 20 66 6f 6f |below,..|func foo|
|00004830| 28 29 20 62 65 67 69 6e | 20 22 61 62 63 22 0d 09 |() begin| "abc"..|
|00004840| 65 6e 64 3b 20 0d 20 09 | 2d 20 61 6c 77 61 79 73 |end; . .|- always|
|00004850| 20 72 65 74 75 72 6e 73 | 20 65 78 61 63 74 6c 79 | returns| exactly|
|00004860| 20 74 68 65 20 73 61 6d | 65 20 73 74 72 69 6e 67 | the sam|e string|
|00004870| 20 2d 20 6e 6f 74 20 64 | 69 66 66 65 72 65 6e 74 | - not d|ifferent|
|00004880| 2c 0d 09 65 71 75 69 76 | 61 6c 65 6e 74 20 73 74 |,..equiv|alent st|
|00004890| 72 69 6e 67 73 2e 0d 09 | 2d 20 49 6e 20 79 6f 75 |rings...|- In you|
|000048a0| 72 20 63 6f 64 65 2c 20 | 61 6e 20 75 6e 71 75 6f |r code, |an unquo|
|000048b0| 74 65 64 20 61 72 72 61 | 79 20 6f 72 20 66 72 61 |ted arra|y or fra|
|000048c0| 6d 65 20 6c 69 74 65 72 | 61 6c 20 77 69 6c 6c 20 |me liter|al will |
|000048d0| 67 65 6e 65 72 61 74 65 | 20 61 0d 09 6e 65 77 20 |generate| a..new |
|000048e0| 61 72 72 61 79 20 6f 72 | 20 66 72 61 6d 65 20 65 |array or| frame e|
|000048f0| 61 63 68 20 74 69 6d 65 | 20 69 74 20 69 73 20 65 |ach time| it is e|
|00004900| 76 61 6c 75 61 74 65 64 | 2e 20 53 6f 20 69 74 d5 |valuated|. So it.|
|00004910| 73 20 61 63 63 65 70 74 | 61 62 6c 65 20 66 6f 72 |s accept|able for|
|00004920| 20 61 0d 09 66 75 6e 63 | 74 69 6f 6e 20 74 6f 20 | a..func|tion to |
|00004930| 72 65 74 75 72 6e 20 5b | 31 2c 32 2c 33 5d 20 6f |return [|1,2,3] o|
|00004940| 72 20 7b 6f 6e 65 3a 20 | 31 2c 74 77 6f 3a 20 32 |r {one: |1,two: 2|
|00004950| 2c 74 68 72 65 65 3a 20 | 33 7d 20 61 73 20 6c 6f |,three: |3} as lo|
|00004960| 6e 67 20 61 73 0d 09 74 | 68 65 79 27 72 65 20 6e |ng as..t|hey're n|
|00004970| 6f 74 20 71 75 6f 74 65 | 64 2e 0d 09 5f 5f 5f 5f |ot quote|d...____|
|00004980| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00004990| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000049a0| 5f 5f 5f 5f 5f 5f 5f 0d | 50 61 73 73 69 6e 67 20 |_______.|Passing |
|000049b0| 41 72 67 75 6d 65 6e 74 | 73 20 28 39 2f 31 35 2f |Argument|s (9/15/|
|000049c0| 39 33 29 20 0d 51 3a 20 | 09 49 73 20 4e 65 77 74 |93) .Q: |.Is Newt|
|000049d0| 6f 6e 53 63 72 69 70 74 | 20 63 61 6c 6c 2d 62 79 |onScript| call-by|
|000049e0| 2d 72 65 66 65 72 65 6e | 63 65 20 6f 72 20 63 61 |-referen|ce or ca|
|000049f0| 6c 6c 2d 62 79 2d 76 61 | 6c 75 65 3f 0d 41 3a 20 |ll-by-va|lue?.A: |
|00004a00| 09 41 20 73 65 65 6d 69 | 6e 67 6c 79 20 73 69 6d |.A seemi|ngly sim|
|00004a10| 70 6c 65 20 71 75 65 73 | 74 69 6f 6e 2e 20 54 68 |ple ques|tion. Th|
|00004a20| 65 20 73 68 6f 72 74 20 | 61 6e 73 77 65 72 20 69 |e short |answer i|
|00004a30| 73 20 d2 63 61 6c 6c 2d | 62 79 2d 76 61 6c 75 65 |s .call-|by-value|
|00004a40| 2c d3 20 74 68 65 20 6c | 69 74 6d 75 73 20 74 65 |,. the l|itmus te|
|00004a50| 73 74 20 62 65 69 6e 67 | 20 74 68 61 74 0d 09 20 |st being| that.. |
|00004a60| 66 75 6e 63 20 66 6f 6f | 28 78 29 20 78 20 3a 3d |func foo|(x) x :=|
|00004a70| 20 31 3b 0d 09 64 6f 65 | 73 20 6e 6f 74 20 61 66 | 1;..doe|s not af|
|00004a80| 66 65 63 74 20 74 68 65 | 20 61 72 67 75 6d 65 6e |fect the| argumen|
|00004a90| 74 20 70 61 73 73 65 64 | 20 74 6f 20 69 74 2e 20 |t passed| to it. |
|00004aa0| 48 6f 77 65 76 65 72 2c | 20 74 68 69 73 20 69 73 |However,| this is|
|00004ab0| 20 6e 6f 74 20 6d 65 61 | 6e 74 20 74 6f 20 69 6d | not mea|nt to im|
|00004ac0| 70 6c 79 20 74 68 61 74 | 20 4e 65 77 74 6f 6e 53 |ply that| NewtonS|
|00004ad0| 63 72 69 70 74 20 66 75 | 6e 63 74 69 6f 6e 73 20 |cript fu|nctions |
|00004ae0| 63 61 6e 20 6e 65 76 65 | 72 20 6d 61 6b 65 20 63 |can neve|r make c|
|00004af0| 68 61 6e 67 65 73 20 74 | 6f 20 74 68 65 69 72 20 |hanges t|o their |
|00004b00| 61 72 67 75 6d 65 6e 74 | 73 2e 20 49 66 20 74 68 |argument|s. If th|
|00004b10| 65 20 61 72 67 75 6d 65 | 6e 74 20 68 61 73 20 73 |e argume|nt has s|
|00004b20| 74 72 75 63 74 75 72 65 | d1 66 6f 72 20 65 78 61 |tructure|.for exa|
|00004b30| 6d 70 6c 65 2c 20 69 66 | 20 69 74 d5 73 20 61 6e |mple, if| it.s an|
|00004b40| 20 61 72 72 61 79 2c 20 | 66 72 61 6d 65 2c 20 6f | array, |frame, o|
|00004b50| 72 20 73 74 72 69 6e 67 | d1 74 68 65 6e 20 63 68 |r string|.then ch|
|00004b60| 61 6e 67 65 73 20 74 6f | 20 74 68 65 20 69 6e 74 |anges to| the int|
|00004b70| 65 72 6e 61 6c 20 73 74 | 72 75 63 74 75 72 65 20 |ernal st|ructure |
|00004b80| 61 72 65 20 70 65 72 73 | 69 73 74 65 6e 74 2e 20 |are pers|istent. |
|00004b90| 43 6f 6e 73 69 64 65 72 | 20 74 68 65 20 66 6f 6c |Consider| the fol|
|00004ba0| 6c 6f 77 69 6e 67 20 63 | 6f 64 65 20 66 72 61 67 |lowing c|ode frag|
|00004bb0| 6d 65 6e 74 73 3a 0d 20 | 09 66 75 6e 63 20 66 6f |ments:. |.func fo|
|00004bc0| 6f 28 78 29 20 78 5b 30 | 5d 20 3a 3d 20 31 3b 20 |o(x) x[0|] := 1; |
|00004bd0| 0d 09 2f 2f 20 63 68 61 | 6e 67 65 73 20 74 68 65 |..// cha|nges the|
|00004be0| 20 31 73 74 20 65 6c 65 | 6d 65 6e 74 20 6f 66 20 | 1st ele|ment of |
|00004bf0| 61 72 72 61 79 20 61 72 | 67 75 6d 65 6e 74 73 0d |array ar|guments.|
|00004c00| 20 0d 09 66 75 6e 63 20 | 66 6f 6f 28 78 29 20 78 | ..func |foo(x) x|
|00004c10| 2e 73 6c 6f 74 31 20 3a | 3d 20 31 3b 20 0d 09 2f |.slot1 :|= 1; ../|
|00004c20| 2f 20 63 68 61 6e 67 65 | 73 20 74 68 65 20 73 6c |/ change|s the sl|
|00004c30| 6f 74 31 20 73 6c 6f 74 | 20 6f 66 20 66 72 61 6d |ot1 slot| of fram|
|00004c40| 65 20 61 72 67 75 6d 65 | 6e 74 73 0d 09 44 65 70 |e argume|nts..Dep|
|00004c50| 65 6e 64 69 6e 67 20 6f | 6e 20 77 68 61 74 20 79 |ending o|n what y|
|00004c60| 6f 75 d5 72 65 20 75 73 | 65 64 20 74 6f 2c 20 74 |ou.re us|ed to, t|
|00004c70| 68 69 73 20 65 78 61 6d | 70 6c 65 20 6d 69 67 68 |his exam|ple migh|
|00004c80| 74 20 62 65 20 63 6f 6e | 66 75 73 69 6e 67 20 62 |t be con|fusing b|
|00004c90| 65 63 61 75 73 65 20 74 | 68 65 20 63 6f 6e 63 65 |ecause t|he conce|
|00004ca0| 70 74 73 20 6f 66 20 63 | 61 6c 6c 2d 62 79 2d 72 |pts of c|all-by-r|
|00004cb0| 65 66 65 72 65 6e 63 65 | 2c 20 63 61 6c 6c 2d 62 |eference|, call-b|
|00004cc0| 79 2d 76 61 6c 75 65 20 | 61 72 65 20 6d 69 78 65 |y-value |are mixe|
|00004cd0| 64 2c 20 61 6e 64 20 63 | 6f 70 79 69 6e 67 20 61 |d, and c|opying a|
|00004ce0| 72 67 75 6d 65 6e 74 73 | 20 61 72 65 20 69 6e 74 |rguments| are int|
|00004cf0| 65 72 74 77 69 6e 65 64 | 20 28 61 6e 64 20 6f 66 |ertwined| (and of|
|00004d00| 74 65 6e 20 6d 69 73 75 | 6e 64 65 72 73 74 6f 6f |ten misu|nderstoo|
|00004d10| 64 2e 29 20 54 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |d.) The |followin|
|00004d20| 67 20 64 69 73 63 75 73 | 73 69 6f 6e 20 6f 66 20 |g discus|sion of |
|00004d30| 74 68 69 73 20 74 65 72 | 6d 69 6e 6f 6c 6f 67 79 |this ter|minology|
|00004d40| 20 77 69 74 68 20 72 65 | 73 70 65 63 74 20 74 6f | with re|spect to|
|00004d50| 20 6f 74 68 65 72 20 6c | 61 6e 67 75 61 67 65 73 | other l|anguages|
|00004d60| 20 6d 61 79 20 68 65 6c | 70 20 63 6c 61 72 69 66 | may hel|p clarif|
|00004d70| 79 20 74 68 65 20 64 69 | 66 66 65 72 65 6e 63 65 |y the di|fference|
|00004d80| 73 2e 0d 09 50 61 73 63 | 61 6c 20 2d 20 53 75 70 |s...Pasc|al - Sup|
|00004d90| 70 6f 72 74 73 20 62 6f | 74 68 20 63 61 6c 6c 2d |ports bo|th call-|
|00004da0| 62 79 2d 72 65 66 65 72 | 65 6e 63 65 20 28 56 41 |by-refer|ence (VA|
|00004db0| 52 20 70 61 72 61 6d 65 | 74 65 72 73 29 20 6f 72 |R parame|ters) or|
|00004dc0| 20 63 61 6c 6c 2d 62 79 | 2d 76 61 6c 75 65 20 28 | call-by|-value (|
|00004dd0| 74 68 65 20 64 65 66 61 | 75 6c 74 29 2e 20 57 68 |the defa|ult). Wh|
|00004de0| 65 6e 20 61 72 72 61 79 | 20 6f 72 20 72 65 63 6f |en array| or reco|
|00004df0| 72 64 20 61 72 67 75 6d | 65 6e 74 73 20 75 73 65 |rd argum|ents use|
|00004e00| 20 63 61 6c 6c 2d 62 79 | 2d 76 61 6c 75 65 2c 20 | call-by|-value, |
|00004e10| 63 6f 70 69 65 73 20 6f | 66 20 74 68 65 20 61 72 |copies o|f the ar|
|00004e20| 72 61 79 73 2f 72 65 63 | 6f 72 64 73 20 61 72 65 |rays/rec|ords are|
|00004e30| 20 6d 61 64 65 20 61 6e | 64 20 70 61 73 73 65 64 | made an|d passed|
|00004e40| 20 69 6e 2e 20 54 6f 20 | 50 61 73 63 61 6c 20 70 | in. To |Pascal p|
|00004e50| 72 6f 67 72 61 6d 6d 65 | 72 73 2c 20 4e 65 77 74 |rogramme|rs, Newt|
|00004e60| 6f 6e 53 63 72 69 70 74 | 20 6d 61 79 20 73 65 65 |onScript| may see|
|00004e70| 6d 20 74 6f 20 70 61 73 | 73 20 61 72 72 61 79 73 |m to pas|s arrays|
|00004e80| 20 61 6e 64 20 66 72 61 | 6d 65 73 20 61 73 20 56 | and fra|mes as V|
|00004e90| 41 52 20 70 61 72 61 6d | 65 74 65 72 73 2e 0d 09 |AR param|eters...|
|00004ea0| 43 20 2d 20 4f 6e 6c 79 | 20 73 75 70 70 6f 72 74 |C - Only| support|
|00004eb0| 73 20 63 61 6c 6c 2d 62 | 79 2d 76 61 6c 75 65 2e |s call-b|y-value.|
|00004ec0| 20 53 74 72 75 63 74 20 | 28 6e 6f 74 20 73 74 72 | Struct |(not str|
|00004ed0| 75 63 74 2a 29 20 61 72 | 67 75 6d 65 6e 74 73 20 |uct*) ar|guments |
|00004ee0| 61 72 65 0d 09 70 61 73 | 73 65 64 20 61 73 20 76 |are..pas|sed as v|
|00004ef0| 61 6c 75 65 73 3b 20 74 | 68 61 74 20 69 73 2c 20 |alues; t|hat is, |
|00004f00| 61 20 63 6f 70 79 20 6f | 66 20 74 68 65 20 73 74 |a copy o|f the st|
|00004f10| 72 75 63 74 20 69 73 20 | 70 61 73 73 65 64 2e 20 |ruct is |passed. |
|00004f20| 48 6f 77 65 76 65 72 2c | 20 61 72 72 61 79 20 61 |However,| array a|
|00004f30| 72 67 75 6d 65 6e 74 73 | 20 70 61 73 73 20 69 6e |rguments| pass in|
|00004f40| 20 74 68 65 20 61 64 64 | 72 65 73 73 20 6f 66 20 | the add|ress of |
|00004f50| 74 68 65 20 66 69 72 73 | 74 20 65 6c 65 6d 65 6e |the firs|t elemen|
|00004f60| 74 20 6f 66 20 74 68 65 | 20 61 72 72 61 79 2e 20 |t of the| array. |
|00004f70| 54 68 75 73 2c 20 43 20 | 70 72 6f 67 72 61 6d 6d |Thus, C |programm|
|00004f80| 65 72 73 20 77 69 6c 6c | 20 66 69 6e 64 20 74 68 |ers will| find th|
|00004f90| 65 20 61 72 72 61 79 20 | 61 72 67 75 6d 65 6e 74 |e array |argument|
|00004fa0| 73 20 74 6f 20 62 65 20 | 74 72 65 61 74 65 64 20 |s to be |treated |
|00004fb0| 6e 6f 72 6d 61 6c 6c 79 | 2e 0d 09 4c 49 53 50 20 |normally|...LISP |
|00004fc0| 2d 20 4f 6e 6c 79 20 73 | 75 70 70 6f 72 74 73 20 |- Only s|upports |
|00004fd0| 63 61 6c 6c 2d 62 79 2d | 76 61 6c 75 65 2e 20 43 |call-by-|value. C|
|00004fe0| 6f 70 69 65 73 20 61 72 | 65 20 6e 6f 74 20 6d 61 |opies ar|e not ma|
|00004ff0| 64 65 20 6f 66 20 73 74 | 72 75 63 74 75 72 65 64 |de of st|ructured|
|00005000| 0d 09 61 72 67 75 6d 65 | 6e 74 73 20 28 6c 69 73 |..argume|nts (lis|
|00005010| 74 73 2c 20 73 74 72 75 | 63 74 75 72 65 73 2c 20 |ts, stru|ctures, |
|00005020| 61 72 72 61 79 73 2c 20 | 6f 62 6a 65 63 74 73 2c |arrays, |objects,|
|00005030| 2e 2e 2e 29 20 41 72 67 | 75 6d 65 6e 74 20 70 61 |...) Arg|ument pa|
|00005040| 73 73 69 6e 67 20 69 6e | 20 4e 65 77 74 6f 6e 20 |ssing in| Newton |
|00005050| 53 63 72 69 70 74 20 77 | 6f 72 6b 73 20 6a 75 73 |Script w|orks jus|
|00005060| 74 20 6c 69 6b 65 20 69 | 74 20 64 6f 65 73 20 69 |t like i|t does i|
|00005070| 6e 20 4c 49 53 50 2e 0d | 09 5f 5f 5f 5f 5f 5f 5f |n LISP..|._______|
|00005080| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00005090| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000050a0| 5f 0d 53 6c 6f 74 20 28 | 56 61 72 69 61 62 6c 65 |_.Slot (|Variable|
|000050b0| 29 20 4c 6f 6f 6b 75 70 | 20 28 39 2f 31 35 2f 39 |) Lookup| (9/15/9|
|000050c0| 33 29 20 0d 51 3a 20 09 | 57 68 61 74 20 64 69 66 |3) .Q: .|What dif|
|000050d0| 66 65 72 65 6e 63 65 73 | 20 61 72 65 20 74 68 65 |ferences| are the|
|000050e0| 72 65 20 61 6d 6f 6e 67 | 20 74 68 65 20 76 61 72 |re among| the var|
|000050f0| 69 6f 75 73 20 77 61 79 | 73 20 74 6f 20 61 63 63 |ious way|s to acc|
|00005100| 65 73 73 20 61 20 73 6c | 6f 74 3f 0d 41 3a 09 54 |ess a sl|ot?.A:.T|
|00005110| 68 65 20 6d 65 61 6e 73 | 20 62 79 20 77 68 69 63 |he means| by whic|
|00005120| 68 20 79 6f 75 20 61 63 | 63 65 73 73 20 61 20 73 |h you ac|cess a s|
|00005130| 6c 6f 74 20 73 70 65 63 | 69 66 69 65 73 20 74 68 |lot spec|ifies th|
|00005140| 65 20 73 65 61 72 63 68 | 20 70 61 74 68 20 61 6e |e search| path an|
|00005150| 64 20 69 6e 68 65 72 69 | 74 61 6e 63 65 20 6d 65 |d inheri|tance me|
|00005160| 63 68 61 6e 69 73 6d 73 | 20 75 73 65 64 20 74 6f |chanisms| used to|
|00005170| 20 6c 6f 63 61 74 65 20 | 69 74 2e 20 45 61 63 68 | locate |it. Each|
|00005180| 20 6f 66 20 74 68 65 20 | 66 69 76 65 20 77 61 79 | of the |five way|
|00005190| 73 20 74 6f 20 61 63 63 | 65 73 73 20 61 20 73 6c |s to acc|ess a sl|
|000051a0| 6f 74 20 69 73 20 64 65 | 73 63 72 69 62 65 64 20 |ot is de|scribed |
|000051b0| 62 65 6c 6f 77 2e 0d 09 | a5 53 70 65 63 69 66 79 |below...|.Specify|
|000051c0| 69 6e 67 20 74 68 65 20 | 73 6c 6f 74 20 6e 61 6d |ing the |slot nam|
|000051d0| 65 20 6f 6e 6c 79 0d 09 | 49 66 20 79 6f 75 20 73 |e only..|If you s|
|000051e0| 70 65 63 69 66 79 20 6f | 6e 6c 79 20 74 68 65 20 |pecify o|nly the |
|000051f0| 6e 61 6d 65 20 6f 66 20 | 74 68 65 20 73 6c 6f 74 |name of |the slot|
|00005200| 2c 20 61 73 20 69 6e 20 | 74 68 65 20 65 78 61 6d |, as in |the exam|
|00005210| 70 6c 65 0d 09 74 68 65 | 53 6c 6f 74 0d 09 74 68 |ple..the|Slot..th|
|00005220| 65 20 73 65 61 72 63 68 | 20 62 65 67 69 6e 73 20 |e search| begins |
|00005230| 69 6e 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 66 |in the c|urrent f|
|00005240| 75 6e 63 74 69 6f 6e 20 | 66 72 61 6d 65 20 77 69 |unction |frame wi|
|00005250| 74 68 20 6c 65 78 69 63 | 61 6c 6c 79 2d 76 69 73 |th lexic|ally-vis|
|00005260| 69 62 6c 65 20 76 61 72 | 69 61 62 6c 65 73 2c 20 |ible var|iables, |
|00005270| 66 6f 6c 6c 6f 77 65 64 | 20 62 79 20 73 6c 6f 74 |followed| by slot|
|00005280| 20 6e 61 6d 65 73 2e 20 | 49 6e 20 6f 74 68 65 72 | names. |In other|
|00005290| 20 77 6f 72 64 73 2c 20 | 69 66 20 74 68 65 20 63 | words, |if the c|
|000052a0| 75 72 72 65 6e 74 6c 79 | 2d 65 78 65 63 75 74 69 |urrently|-executi|
|000052b0| 6e 67 20 66 75 6e 63 74 | 69 6f 6e 20 68 61 73 20 |ng funct|ion has |
|000052c0| 61 20 6c 6f 63 61 6c 20 | 76 61 72 69 61 62 6c 65 |a local |variable|
|000052d0| 20 6e 61 6d 65 64 20 74 | 68 65 53 6c 6f 74 2c 20 | named t|heSlot, |
|000052e0| 69 74 20 69 73 20 66 6f | 75 6e 64 20 62 65 66 6f |it is fo|und befo|
|000052f0| 72 65 20 61 20 6c 6f 63 | 61 6c 20 76 61 72 69 61 |re a loc|al varia|
|00005300| 62 6c 65 20 6e 61 6d 65 | 64 20 74 68 65 53 6c 6f |ble name|d theSlo|
|00005310| 74 20 69 6e 20 74 68 65 | 20 65 6e 63 6c 6f 73 69 |t in the| enclosi|
|00005320| 6e 67 20 66 75 6e 63 74 | 69 6f 6e 2c 20 61 6e 64 |ng funct|ion, and|
|00005330| 20 73 6f 20 6f 6e 2e 20 | 53 69 6d 69 6c 61 72 6c | so on. |Similarl|
|00005340| 79 2c 20 61 6e 79 20 6f | 66 20 74 68 6f 73 65 20 |y, any o|f those |
|00005350| 76 61 72 69 61 62 6c 65 | 73 20 61 72 65 20 66 6f |variable|s are fo|
|00005360| 75 6e 64 20 28 69 6e 20 | 73 63 6f 70 65 20 6f 72 |und (in |scope or|
|00005370| 64 65 72 29 20 62 65 66 | 6f 72 65 20 61 6e 20 61 |der) bef|ore an a|
|00005380| 63 74 75 61 6c 20 73 6c | 6f 74 20 6e 61 6d 65 64 |ctual sl|ot named|
|00005390| 20 74 68 65 53 6c 6f 74 | 20 69 73 20 66 6f 75 6e | theSlot| is foun|
|000053a0| 64 2e 20 49 66 20 61 20 | 76 61 72 69 61 62 6c 65 |d. If a |variable|
|000053b0| 20 6e 61 6d 65 64 20 74 | 68 65 53 6c 6f 74 20 69 | named t|heSlot i|
|000053c0| 73 20 6e 6f 74 20 66 6f | 75 6e 64 2c 20 67 6c 6f |s not fo|und, glo|
|000053d0| 62 61 6c 20 76 61 72 69 | 61 62 6c 65 73 20 61 72 |bal vari|ables ar|
|000053e0| 65 20 73 65 61 72 63 68 | 65 64 20 6e 65 78 74 2e |e search|ed next.|
|000053f0| 20 49 66 20 61 20 67 6c | 6f 62 61 6c 20 76 61 72 | If a gl|obal var|
|00005400| 69 61 62 6c 65 20 69 73 | 20 6e 6f 74 20 66 6f 75 |iable is| not fou|
|00005410| 6e 64 2c 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 |nd, the |current |
|00005420| 72 65 63 65 69 76 65 72 | 20 69 73 20 73 65 61 72 |receiver| is sear|
|00005430| 63 68 65 64 20 66 6f 72 | 20 61 20 73 6c 6f 74 20 |ched for| a slot |
|00005440| 6e 61 6d 65 64 20 74 68 | 65 53 6c 6f 74 2e 0d 09 |named th|eSlot...|
|00005450| 49 66 20 74 68 65 20 73 | 6c 6f 74 20 69 73 20 6e |If the s|lot is n|
|00005460| 6f 74 20 66 6f 75 6e 64 | 20 69 6e 20 74 68 65 20 |ot found| in the |
|00005470| 72 65 63 65 69 76 65 72 | 20 6f 66 20 74 68 65 20 |receiver| of the |
|00005480| 6d 65 73 73 61 67 65 2c | 20 74 68 65 20 72 65 6d |message,| the rem|
|00005490| 61 69 6e 69 6e 67 20 66 | 72 61 6d 65 73 20 61 72 |aining f|rames ar|
|000054a0| 65 20 73 65 61 72 63 68 | 65 64 20 69 6e 20 6f 72 |e search|ed in or|
|000054b0| 64 65 72 20 6f 66 20 70 | 72 6f 74 6f 74 79 70 65 |der of p|rototype|
|000054c0| 20 61 6e 64 20 70 61 72 | 65 6e 74 20 69 6e 68 65 | and par|ent inhe|
|000054d0| 72 69 74 61 6e 63 65 2e | 20 41 6e 20 65 78 63 65 |ritance.| An exce|
|000054e0| 70 74 69 6f 6e 20 69 73 | 20 74 68 72 6f 77 6e 20 |ption is| thrown |
|000054f0| 69 66 20 79 6f 75 20 74 | 72 79 20 74 6f 20 61 63 |if you t|ry to ac|
|00005500| 63 65 73 73 20 61 20 73 | 6c 6f 74 20 74 68 61 74 |cess a s|lot that|
|00005510| 20 63 61 6e 27 74 20 62 | 65 20 66 6f 75 6e 64 2e | can't b|e found.|
|00005520| 20 20 49 66 20 79 6f 75 | 20 64 6f 20 61 6e 20 61 | If you| do an a|
|00005530| 73 73 69 67 6e 6d 65 6e | 74 20 6f 70 65 72 61 74 |ssignmen|t operat|
|00005540| 69 6f 6e 20 75 73 69 6e | 67 20 61 6e 20 75 6e 64 |ion usin|g an und|
|00005550| 65 63 6c 61 72 65 64 20 | 73 6c 6f 74 2c 20 74 68 |eclared |slot, th|
|00005560| 65 20 73 6c 6f 74 20 69 | 73 20 63 72 65 61 74 65 |e slot i|s create|
|00005570| 64 20 69 66 20 79 6f 75 | 20 70 6c 61 63 65 20 74 |d if you| place t|
|00005580| 68 65 20 73 65 6c 66 2e | 20 70 72 65 66 69 78 20 |he self.| prefix |
|00005590| 69 6e 20 66 72 6f 6e 74 | 20 6f 66 20 74 68 65 20 |in front| of the |
|000055a0| 73 6c 6f 74 20 6e 61 6d | 65 3b 20 69 66 20 79 6f |slot nam|e; if yo|
|000055b0| 75 20 64 6f 20 74 68 65 | 20 6f 70 65 72 61 74 69 |u do the| operati|
|000055c0| 6f 6e 20 77 69 74 68 6f | 75 74 20 74 68 65 20 73 |on witho|ut the s|
|000055d0| 65 6c 66 2e 20 70 72 65 | 66 69 78 20 79 6f 75 20 |elf. pre|fix you |
|000055e0| 77 69 6c 6c 20 67 65 74 | 20 61 20 6c 6f 63 61 6c |will get| a local|
|000055f0| 20 76 61 72 69 61 62 6c | 65 2e 0d 09 a5 55 73 69 | variabl|e....Usi|
|00005600| 6e 67 20 74 68 65 20 64 | 6f 74 20 28 2e 29 20 6f |ng the d|ot (.) o|
|00005610| 70 65 72 61 74 6f 72 0d | 09 49 66 20 79 6f 75 20 |perator.|.If you |
|00005620| 75 73 65 20 74 68 65 20 | 64 6f 74 20 6f 70 65 72 |use the |dot oper|
|00005630| 61 74 6f 72 20 74 6f 20 | 73 70 65 63 69 66 79 20 |ator to |specify |
|00005640| 74 68 65 20 66 72 61 6d | 65 20 61 6e 64 20 74 68 |the fram|e and th|
|00005650| 65 20 73 6c 6f 74 2c 20 | 20 61 73 20 69 6e 20 74 |e slot, | as in t|
|00005660| 68 65 20 65 78 61 6d 70 | 6c 65 0d 09 6d 79 66 72 |he examp|le..myfr|
|00005670| 61 6d 65 2e 6d 79 73 6c | 6f 74 0d 09 74 68 65 20 |ame.mysl|ot..the |
|00005680| 73 65 61 72 63 68 20 62 | 65 67 69 6e 73 20 69 6e |search b|egins in|
|00005690| 20 74 68 65 20 73 70 65 | 63 69 66 69 65 64 20 66 | the spe|cified f|
|000056a0| 72 61 6d 65 2e 20 20 49 | 66 20 74 68 65 20 73 6c |rame. I|f the sl|
|000056b0| 6f 74 20 69 73 20 6e 6f | 74 20 66 6f 75 6e 64 20 |ot is no|t found |
|000056c0| 69 6e 20 74 68 65 20 73 | 70 65 63 69 66 69 65 64 |in the s|pecified|
|000056d0| 20 66 72 61 6d 65 2c 20 | 74 68 65 20 72 65 6d 61 | frame, |the rema|
|000056e0| 69 6e 69 6e 67 20 66 72 | 61 6d 65 73 20 61 72 65 |ining fr|ames are|
|000056f0| 20 73 65 61 72 63 68 65 | 64 20 69 6e 20 6f 72 64 | searche|d in ord|
|00005700| 65 72 20 6f 66 20 70 72 | 6f 74 6f 74 79 70 65 20 |er of pr|ototype |
|00005710| 69 6e 68 65 72 69 74 61 | 6e 63 65 2e 20 20 50 61 |inherita|nce. Pa|
|00005720| 72 65 6e 74 20 69 6e 68 | 65 72 69 74 61 6e 63 65 |rent inh|eritance|
|00005730| 20 70 61 74 68 73 20 61 | 72 65 20 6e 6f 74 20 73 | paths a|re not s|
|00005740| 65 61 72 63 68 65 64 2e | 20 49 66 20 74 68 65 20 |earched.| If the |
|00005750| 73 6c 6f 74 20 64 6f 65 | 73 20 6e 6f 74 20 65 78 |slot doe|s not ex|
|00005760| 69 73 74 2c 20 74 68 65 | 20 73 79 73 74 65 6d 20 |ist, the| system |
|00005770| 72 65 74 75 72 6e 73 20 | 4e 49 4c 2e 0d 20 0d 09 |returns |NIL.. ..|
|00005780| a5 55 73 69 6e 67 20 74 | 68 65 20 47 65 74 53 6c |.Using t|he GetSl|
|00005790| 6f 74 20 66 75 6e 63 74 | 69 6f 6e 0d 09 49 66 20 |ot funct|ion..If |
|000057a0| 79 6f 75 20 63 61 6c 6c | 20 0d 09 47 65 74 53 6c |you call| ..GetSl|
|000057b0| 6f 74 28 66 72 61 6d 65 | 2c 20 73 6c 6f 74 29 20 |ot(frame|, slot) |
|000057c0| 0d 09 6f 6e 6c 79 20 74 | 68 65 20 73 70 65 63 69 |..only t|he speci|
|000057d0| 66 69 65 64 20 66 72 61 | 6d 65 20 69 73 20 73 65 |fied fra|me is se|
|000057e0| 61 72 63 68 65 64 20 66 | 6f 72 20 74 68 65 20 73 |arched f|or the s|
|000057f0| 70 65 63 69 66 69 65 64 | 20 73 6c 6f 74 2e 20 49 |pecified| slot. I|
|00005800| 6e 68 65 72 69 74 61 6e | 63 65 20 70 61 74 68 73 |nheritan|ce paths|
|00005810| 20 61 72 65 20 6e 6f 74 | 20 73 65 61 72 63 68 65 | are not| searche|
|00005820| 64 2e 0d 09 a5 55 73 69 | 6e 67 20 74 68 65 20 47 |d....Usi|ng the G|
|00005830| 65 74 56 61 72 69 61 62 | 6c 65 20 66 75 6e 63 74 |etVariab|le funct|
|00005840| 69 6f 6e 0d 09 49 66 20 | 79 6f 75 20 63 61 6c 6c |ion..If |you call|
|00005850| 20 0d 09 47 65 74 56 61 | 72 69 61 62 6c 65 28 66 | ..GetVa|riable(f|
|00005860| 72 61 6d 65 2c 20 73 6c | 6f 74 29 20 0d 09 74 68 |rame, sl|ot) ..th|
|00005870| 65 20 73 65 61 72 63 68 | 20 62 65 67 69 6e 73 20 |e search| begins |
|00005880| 69 6e 20 74 68 65 20 73 | 70 65 63 69 66 69 65 64 |in the s|pecified|
|00005890| 20 66 72 61 6d 65 2e 20 | 20 49 66 20 74 68 65 20 | frame. | If the |
|000058a0| 73 6c 6f 74 20 69 73 20 | 6e 6f 74 20 66 6f 75 6e |slot is |not foun|
|000058b0| 64 20 69 6e 20 74 68 65 | 20 63 75 72 72 65 6e 74 |d in the| current|
|000058c0| 20 66 72 61 6d 65 2c 20 | 74 68 65 20 72 65 6d 61 | frame, |the rema|
|000058d0| 69 6e 69 6e 67 20 66 72 | 61 6d 65 73 20 61 72 65 |ining fr|ames are|
|000058e0| 20 73 65 61 72 63 68 65 | 64 20 69 6e 20 6f 72 64 | searche|d in ord|
|000058f0| 65 72 20 6f 66 20 70 72 | 6f 74 6f 74 79 70 65 20 |er of pr|ototype |
|00005900| 61 6e 64 20 70 61 72 65 | 6e 74 20 69 6e 68 65 72 |and pare|nt inher|
|00005910| 69 74 61 6e 63 65 2e 0d | 09 a5 47 65 74 56 61 72 |itance..|..GetVar|
|00005920| 20 77 69 6c 6c 20 62 65 | 20 72 65 6d 6f 76 65 64 | will be| removed|
|00005930| 20 66 72 6f 6d 20 74 68 | 65 20 6c 61 6e 67 75 61 | from th|e langua|
|00005940| 67 65 0d 59 6f 75 20 63 | 61 6e 20 75 73 75 61 6c |ge.You c|an usual|
|00005950| 6c 79 20 73 69 6d 75 6c | 61 74 65 20 47 65 74 56 |ly simul|ate GetV|
|00005960| 61 72 20 75 73 69 6e 67 | 20 47 65 74 56 61 72 69 |ar using| GetVari|
|00005970| 61 62 6c 65 28 73 65 6c | 66 2c 73 6c 6f 74 29 2e |able(sel|f,slot).|
|00005980| 20 54 68 65 20 64 69 66 | 66 65 72 65 6e 63 65 20 | The dif|ference |
|00005990| 77 69 6c 6c 20 62 65 20 | 74 68 61 74 20 6c 6f 63 |will be |that loc|
|000059a0| 61 6c 20 76 61 72 69 61 | 62 6c 65 73 20 77 69 6c |al varia|bles wil|
|000059b0| 6c 20 6e 6f 74 20 62 65 | 20 66 6f 75 6e 64 20 2d |l not be| found -|
|000059c0| 20 6f 6e 6c 79 20 73 6c | 6f 74 73 2e 0d 49 66 20 | only sl|ots..If |
|000059d0| 79 6f 75 20 75 73 65 20 | 47 65 74 56 61 72 20 79 |you use |GetVar y|
|000059e0| 6f 75 20 6d 61 79 20 66 | 69 6e 64 20 74 68 61 74 |ou may f|ind that|
|000059f0| 20 69 73 20 6e 6f 74 20 | 61 76 61 69 6c 61 62 6c | is not |availabl|
|00005a00| 65 20 69 6e 20 66 75 74 | 75 72 65 20 70 72 6f 64 |e in fut|ure prod|
|00005a10| 75 63 74 73 2c 20 69 6e | 20 77 68 69 63 68 20 63 |ucts, in| which c|
|00005a20| 61 73 65 20 79 6f 75 72 | 20 63 6f 64 65 20 77 69 |ase your| code wi|
|00005a30| 6c 6c 20 74 68 72 6f 77 | 20 61 6e 20 65 78 63 65 |ll throw| an exce|
|00005a40| 70 74 69 6f 6e 3b 20 6f | 72 20 20 47 65 74 56 61 |ption; o|r GetVa|
|00005a50| 72 20 6d 61 79 20 77 6f | 72 6b 20 64 69 66 66 65 |r may wo|rk diffe|
|00005a60| 72 65 6e 74 6c 79 20 6e | 6f 74 20 66 69 6e 64 69 |rently n|ot findi|
|00005a70| 6e 67 20 6c 6f 63 61 6c | 20 76 61 72 69 61 62 6c |ng local| variabl|
|00005a80| 65 73 20 61 6e 79 6d 6f | 72 65 2c 20 69 6e 20 77 |es anymo|re, in w|
|00005a90| 68 69 63 68 20 63 61 73 | 65 20 79 6f 75 72 20 63 |hich cas|e your c|
|00005aa0| 6f 64 65 20 6d 61 79 20 | 73 75 62 74 6c 79 20 62 |ode may |subtly b|
|00005ab0| 72 65 61 6b 2e 20 44 54 | 53 20 61 64 76 69 73 65 |reak. DT|S advise|
|00005ac0| 73 20 61 67 61 69 6e 73 | 74 20 75 73 69 6e 67 20 |s agains|t using |
|00005ad0| 47 65 74 56 61 72 2e 0d | 09 5f 5f 5f 5f 5f 5f 5f |GetVar..|._______|
|00005ae0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00005af0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00005b00| 5f 5f 5f 5f 0d 54 65 73 | 74 69 6e 67 20 74 68 65 |____.Tes|ting the|
|00005b10| 20 45 78 69 73 74 65 6e | 63 65 20 6f 66 20 61 20 | Existen|ce of a |
|00005b20| 53 6c 6f 74 20 28 56 61 | 72 69 61 62 6c 65 29 20 |Slot (Va|riable) |
|00005b30| 28 39 2f 31 35 2f 39 33 | 29 20 28 4f 62 73 6f 6c |(9/15/93|) (Obsol|
|00005b40| 65 74 65 64 20 62 79 20 | 4e 53 20 31 2e 30 20 46 |eted by |NS 1.0 F|
|00005b50| 69 6e 61 6c 20 44 6f 63 | 75 6d 65 6e 74 61 74 69 |inal Doc|umentati|
|00005b60| 6f 6e 29 2e 0d 51 3a 20 | 09 57 68 61 74 20 64 69 |on)..Q: |.What di|
|00005b70| 66 66 65 72 65 6e 63 65 | 73 20 61 72 65 20 74 68 |fference|s are th|
|00005b80| 65 72 65 20 61 6d 6f 6e | 67 20 74 68 65 20 76 61 |ere amon|g the va|
|00005b90| 72 69 6f 75 73 20 77 61 | 79 73 20 74 6f 20 64 65 |rious wa|ys to de|
|00005ba0| 74 65 72 6d 69 6e 65 20 | 77 68 65 74 68 65 72 20 |termine |whether |
|00005bb0| 61 20 73 6c 6f 74 20 65 | 78 69 73 74 73 20 69 6e |a slot e|xists in|
|00005bc0| 20 61 20 66 72 61 6d 65 | 3f 0d 41 3a 09 54 68 65 | a frame|?.A:.The|
|00005bd0| 20 6d 65 61 6e 73 20 62 | 79 20 77 68 69 63 68 20 | means b|y which |
|00005be0| 79 6f 75 20 74 65 73 74 | 20 66 6f 72 20 61 20 73 |you test| for a s|
|00005bf0| 6c 6f 74 27 73 20 65 78 | 69 73 74 65 6e 63 65 20 |lot's ex|istence |
|00005c00| 73 70 65 63 69 66 69 65 | 73 20 74 68 65 20 73 65 |specifie|s the se|
|00005c10| 61 72 63 68 20 70 61 74 | 68 20 61 6e 64 20 6b 69 |arch pat|h and ki|
|00005c20| 6e 64 73 20 6f 66 20 69 | 6e 68 65 72 69 74 61 6e |nds of i|nheritan|
|00005c30| 63 65 20 75 73 65 64 20 | 74 6f 20 64 69 73 63 6f |ce used |to disco|
|00005c40| 76 65 72 20 69 74 2e 20 | 54 68 65 20 66 6f 6c 6c |ver it. |The foll|
|00005c50| 6f 77 69 6e 67 20 65 78 | 61 6d 70 6c 65 73 20 64 |owing ex|amples d|
|00005c60| 65 73 63 72 69 62 65 20 | 74 68 72 65 65 20 77 61 |escribe |three wa|
|00005c70| 79 73 20 74 6f 20 64 69 | 73 63 6f 76 65 72 20 74 |ys to di|scover t|
|00005c80| 68 65 20 65 78 69 73 74 | 65 6e 63 65 20 6f 66 20 |he exist|ence of |
|00005c90| 61 20 73 6c 6f 74 20 69 | 6e 20 61 20 66 72 61 6d |a slot i|n a fram|
|00005ca0| 65 2e 0d 09 a5 20 55 73 | 69 6e 67 20 74 68 65 20 |e.... Us|ing the |
|00005cb0| 65 78 69 73 74 73 20 6f | 70 65 72 61 74 6f 72 0d |exists o|perator.|
|00005cc0| 09 54 68 65 20 65 78 69 | 73 74 73 20 6f 70 65 72 |.The exi|sts oper|
|00005cd0| 61 74 6f 72 20 66 6f 6c | 6c 6f 77 73 20 74 68 65 |ator fol|lows the|
|00005ce0| 20 73 61 6d 65 20 72 75 | 6c 65 73 20 61 73 20 74 | same ru|les as t|
|00005cf0| 68 65 20 65 78 70 72 65 | 73 73 69 6f 6e 20 74 6f |he expre|ssion to|
|00005d00| 20 77 68 69 63 68 20 69 | 74 20 69 73 20 61 70 70 | which i|t is app|
|00005d10| 6c 69 65 64 2e 20 46 6f | 72 20 65 78 61 6d 70 6c |lied. Fo|r exampl|
|00005d20| 65 2c 20 69 66 20 79 6f | 75 20 75 73 65 20 74 68 |e, if yo|u use th|
|00005d30| 69 73 20 6f 70 65 72 61 | 74 6f 72 20 74 6f 20 74 |is opera|tor to t|
|00005d40| 65 73 74 20 61 20 73 6c | 6f 74 20 61 63 63 65 73 |est a sl|ot acces|
|00005d50| 73 20 65 78 70 72 65 73 | 73 69 6f 6e 2c 20 61 73 |s expres|sion, as|
|00005d60| 20 69 6e 20 74 68 65 20 | 65 78 61 6d 70 6c 65 0d | in the |example.|
|00005d70| 09 6d 79 66 72 61 6d 65 | 2e 6d 79 73 6c 6f 74 20 |.myframe|.myslot |
|00005d80| 65 78 69 73 74 73 20 0d | 09 74 68 65 20 73 65 61 |exists .|.the sea|
|00005d90| 72 63 68 20 62 65 67 69 | 6e 73 20 69 6e 20 74 68 |rch begi|ns in th|
|00005da0| 65 20 73 70 65 63 69 66 | 69 65 64 20 66 72 61 6d |e specif|ied fram|
|00005db0| 65 2e 20 20 49 66 20 74 | 68 65 20 73 6c 6f 74 20 |e. If t|he slot |
|00005dc0| 69 73 20 6e 6f 74 20 66 | 6f 75 6e 64 20 69 6e 20 |is not f|ound in |
|00005dd0| 74 68 65 20 63 75 72 72 | 65 6e 74 20 66 72 61 6d |the curr|ent fram|
|00005de0| 65 2c 20 74 68 65 20 72 | 65 6d 61 69 6e 69 6e 67 |e, the r|emaining|
|00005df0| 20 66 72 61 6d 65 73 20 | 61 72 65 20 73 65 61 72 | frames |are sear|
|00005e00| 63 68 65 64 20 69 6e 20 | 6f 72 64 65 72 20 6f 66 |ched in |order of|
|00005e10| 20 70 72 6f 74 6f 74 79 | 70 65 20 69 6e 68 65 72 | prototy|pe inher|
|00005e20| 69 74 61 6e 63 65 20 6f | 6e 6c 79 2e 20 50 61 72 |itance o|nly. Par|
|00005e30| 65 6e 74 20 69 6e 68 65 | 72 69 74 61 6e 63 65 20 |ent inhe|ritance |
|00005e40| 70 61 74 68 73 20 61 72 | 65 20 6e 6f 74 20 73 65 |paths ar|e not se|
|00005e50| 61 72 63 68 65 64 2e 0d | 09 48 6f 77 65 76 65 72 |arched..|.However|
|00005e60| 2c 20 77 68 65 6e 20 75 | 73 69 6e 67 20 74 68 65 |, when u|sing the|
|00005e70| 20 65 78 69 73 74 73 20 | 6f 70 65 72 61 74 6f 72 | exists |operator|
|00005e80| 20 74 6f 20 63 68 65 63 | 6b 20 77 68 65 74 68 65 | to chec|k whethe|
|00005e90| 72 20 61 6e 20 69 64 65 | 6e 74 69 66 69 65 72 20 |r an ide|ntifier |
|00005ea0| 65 78 69 73 74 73 2c 20 | 61 73 20 69 6e 20 74 68 |exists, |as in th|
|00005eb0| 65 20 65 78 61 6d 70 6c | 65 0d 09 6d 79 76 61 72 |e exampl|e..myvar|
|00005ec0| 20 65 78 69 73 74 73 20 | 0d 09 62 6f 74 68 20 70 | exists |..both p|
|00005ed0| 72 6f 74 6f 74 79 70 65 | 20 61 6e 64 20 70 61 72 |rototype| and par|
|00005ee0| 65 6e 74 20 69 6e 68 65 | 72 69 74 61 6e 63 65 20 |ent inhe|ritance |
|00005ef0| 70 61 74 68 73 20 61 72 | 65 20 73 65 61 72 63 68 |paths ar|e search|
|00005f00| 65 64 2e 0d 09 a5 20 55 | 73 69 6e 67 20 74 68 65 |ed.... U|sing the|
|00005f10| 20 48 61 73 53 6c 6f 74 | 20 66 75 6e 63 74 69 6f | HasSlot| functio|
|00005f20| 6e 0d 09 49 66 20 79 6f | 75 20 63 61 6c 6c 0d 09 |n..If yo|u call..|
|00005f30| 48 61 73 53 6c 6f 74 28 | 66 72 61 6d 65 2c 20 73 |HasSlot(|frame, s|
|00005f40| 6c 6f 74 29 0d 09 6f 6e | 6c 79 20 74 68 65 20 73 |lot)..on|ly the s|
|00005f50| 70 65 63 69 66 69 65 64 | 20 66 72 61 6d 65 20 69 |pecified| frame i|
|00005f60| 73 20 73 65 61 72 63 68 | 65 64 20 66 6f 72 20 74 |s search|ed for t|
|00005f70| 68 65 20 73 70 65 63 69 | 66 69 65 64 20 73 6c 6f |he speci|fied slo|
|00005f80| 74 2e 20 49 6e 68 65 72 | 69 74 61 6e 63 65 20 70 |t. Inher|itance p|
|00005f90| 61 74 68 73 20 61 72 65 | 20 6e 6f 74 20 73 65 61 |aths are| not sea|
|00005fa0| 72 63 68 65 64 2e 0d 09 | a5 20 55 73 69 6e 67 20 |rched...|. Using |
|00005fb0| 74 68 65 20 48 61 73 56 | 61 72 69 61 62 6c 65 20 |the HasV|ariable |
|00005fc0| 66 75 6e 63 74 69 6f 6e | 0d 09 49 66 20 79 6f 75 |function|..If you|
|00005fd0| 20 63 61 6c 6c 0d 09 48 | 61 73 56 61 72 69 61 62 | call..H|asVariab|
|00005fe0| 6c 65 28 66 72 61 6d 65 | 2c 20 73 6c 6f 74 29 0d |le(frame|, slot).|
|00005ff0| 09 74 68 65 20 73 65 61 | 72 63 68 20 62 65 67 69 |.the sea|rch begi|
|00006000| 6e 73 20 69 6e 20 74 68 | 65 20 63 75 72 72 65 6e |ns in th|e curren|
|00006010| 74 20 66 72 61 6d 65 2e | 20 49 66 20 74 68 65 20 |t frame.| If the |
|00006020| 73 6c 6f 74 20 69 73 20 | 6e 6f 74 20 66 6f 75 6e |slot is |not foun|
|00006030| 64 20 69 6e 20 74 68 65 | 20 63 75 72 72 65 6e 74 |d in the| current|
|00006040| 20 66 72 61 6d 65 2c 20 | 74 68 65 20 72 65 6d 61 | frame, |the rema|
|00006050| 69 6e 69 6e 67 20 66 72 | 61 6d 65 73 20 61 72 65 |ining fr|ames are|
|00006060| 20 73 65 61 72 63 68 65 | 64 20 69 6e 20 6f 72 64 | searche|d in ord|
|00006070| 65 72 20 6f 66 20 70 72 | 6f 74 6f 74 79 70 65 20 |er of pr|ototype |
|00006080| 61 6e 64 20 70 61 72 65 | 6e 74 20 69 6e 68 65 72 |and pare|nt inher|
|00006090| 69 74 61 6e 63 65 2e 0d | 09 5f 5f 5f 5f 5f 5f 5f |itance..|._______|
|000060a0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000060b0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000060c0| 5f 5f 5f 5f 0d 43 61 6c | 6c 69 6e 67 20 4d 65 74 |____.Cal|ling Met|
|000060d0| 68 6f 64 73 20 4f 75 74 | 20 4f 66 20 53 6c 6f 74 |hods Out| Of Slot|
|000060e0| 20 43 6f 6e 74 65 78 74 | 20 28 39 2f 31 35 2f 39 | Context| (9/15/9|
|000060f0| 33 29 20 28 4f 62 73 6f | 6c 65 74 65 64 20 62 79 |3) (Obso|leted by|
|00006100| 20 4e 53 20 47 75 69 64 | 65 20 31 2e 30 20 46 69 | NS Guid|e 1.0 Fi|
|00006110| 6e 61 6c 20 44 6f 63 75 | 6d 65 6e 74 61 74 69 6f |nal Docu|mentatio|
|00006120| 6e 29 0d 51 3a 20 09 49 | 27 6d 20 74 72 79 69 6e |n).Q: .I|'m tryin|
|00006130| 67 20 74 6f 20 70 75 6c | 6c 20 61 20 6d 65 74 68 |g to pul|l a meth|
|00006140| 6f 64 20 6f 75 74 20 6f | 66 20 61 20 73 6c 6f 74 |od out o|f a slot|
|00006150| 20 61 6e 64 20 63 61 6c | 6c 20 69 74 2e 20 55 6e | and cal|l it. Un|
|00006160| 66 6f 72 74 75 6e 61 74 | 65 6c 79 2c 20 74 68 65 |fortunat|ely, the|
|00006170| 20 66 75 6e 63 74 69 6f | 6e 73 20 61 70 70 6c 79 | functio|ns apply|
|00006180| 20 61 6e 64 20 63 61 6c | 6c 20 62 6f 74 68 20 73 | and cal|l both s|
|00006190| 65 65 6d 20 74 6f 20 73 | 65 74 20 73 65 6c 66 20 |eem to s|et self |
|000061a0| 74 6f 20 7b 7d 2e 20 49 | 73 20 74 68 65 72 65 20 |to {}. I|s there |
|000061b0| 61 6e 6f 74 68 65 72 20 | 77 61 79 3f 0d 41 3a 20 |another |way?.A: |
|000061c0| 09 54 68 65 20 67 6c 6f | 62 61 6c 20 66 75 6e 63 |.The glo|bal func|
|000061d0| 74 69 6f 6e 20 50 65 72 | 66 6f 72 6d 28 66 72 61 |tion Per|form(fra|
|000061e0| 6d 65 2c 20 6d 65 73 73 | 61 67 65 2c 20 70 61 72 |me, mess|age, par|
|000061f0| 61 6d 61 74 65 72 41 72 | 72 61 79 29 20 64 6f 65 |amaterAr|ray) doe|
|00006200| 73 20 77 68 61 74 20 79 | 6f 75 20 77 61 6e 74 2c |s what y|ou want,|
|00006210| 20 65 78 63 65 70 74 20 | 74 68 61 74 20 74 68 65 | except |that the|
|00006220| 20 6d 65 74 68 6f 64 20 | 6e 65 65 64 73 20 74 6f | method |needs to|
|00006230| 20 62 65 20 69 6e 20 61 | 20 73 6c 6f 74 20 69 6e | be in a| slot in|
|00006240| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 66 72 61 | the cur|rent fra|
|00006250| 6d 65 20 69 66 20 79 6f | 75 20 72 65 61 6c 6c 79 |me if yo|u really|
|00006260| 20 77 61 6e 74 20 74 6f | 20 70 72 65 73 65 72 76 | want to| preserv|
|00006270| 65 20 74 68 65 20 76 61 | 6c 75 65 20 6f 66 20 73 |e the va|lue of s|
|00006280| 65 6c 66 2e 0d 09 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |elf...__|________|
|00006290| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000062a0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000062b0| 5f 0d 49 6e 68 65 72 69 | 74 65 64 20 28 31 30 2f |_.Inheri|ted (10/|
|000062c0| 31 33 2f 39 33 29 20 28 | 4f 62 73 6f 6c 65 74 65 |13/93) (|Obsolete|
|000062d0| 64 20 62 79 20 4e 53 20 | 47 75 69 64 65 20 31 2e |d by NS |Guide 1.|
|000062e0| 30 20 46 69 6e 61 6c 20 | 44 6f 63 75 6d 65 6e 74 |0 Final |Document|
|000062f0| 61 74 69 6f 6e 29 0d 51 | 3a 20 09 57 68 61 74 20 |ation).Q|: .What |
|00006300| 69 73 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 20 |is the f|unction |
|00006310| 6f 66 20 22 69 6e 68 65 | 72 69 74 65 64 3a 22 20 |of "inhe|rited:" |
|00006320| 61 6e 64 20 22 69 6e 68 | 65 72 69 74 65 64 3a 3f |and "inh|erited:?|
|00006330| 22 0d 41 3a 20 20 49 6e | 20 4e 65 77 74 6f 6e 53 |".A: In| NewtonS|
|00006340| 63 72 69 70 74 2c 20 74 | 68 65 20 69 6e 68 65 72 |cript, t|he inher|
|00006350| 69 74 65 64 3a 58 28 29 | 20 6d 65 73 73 61 67 65 |ited:X()| message|
|00006360| 20 73 65 6e 64 20 73 70 | 65 63 69 66 69 65 73 20 | send sp|ecifies |
|00006370| 61 20 4e 65 77 74 6f 6e | 53 63 72 69 70 74 20 66 |a Newton|Script f|
|00006380| 75 6e 63 74 69 6f 6e 20 | 63 61 6c 6c 20 6f 6e 20 |unction |call on |
|00006390| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 58 2c 20 |the func|tion X, |
|000063a0| 77 68 65 72 65 20 58 20 | 69 73 20 66 6f 75 6e 64 |where X |is found|
|000063b0| 20 55 50 20 74 68 65 20 | 69 6e 68 65 72 69 74 61 | UP the |inherita|
|000063c0| 6e 63 65 20 63 68 61 69 | 6e 20 73 74 61 72 74 69 |nce chai|n starti|
|000063d0| 6e 67 20 66 72 6f 6d 20 | 74 68 65 20 63 61 6c 6c |ng from |the call|
|000063e0| 65 72 27 73 20 5f 70 72 | 6f 74 6f 2e 20 49 6e 20 |er's _pr|oto. In |
|000063f0| 6f 74 68 65 72 20 77 6f | 72 64 73 2c 20 6c 6f 6f |other wo|rds, loo|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.